summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/aliases.c78
-rw-r--r--source4/torture/basic/charset.c18
-rw-r--r--source4/torture/basic/denytest.c48
-rw-r--r--source4/torture/basic/dfstest.c226
-rw-r--r--source4/torture/basic/mangle_test.c44
-rw-r--r--source4/torture/basic/scanner.c74
-rw-r--r--source4/torture/basic/utable.c38
-rw-r--r--source4/torture/gentest.c48
-rw-r--r--source4/torture/locktest.c42
-rw-r--r--source4/torture/locktest2.c44
-rw-r--r--source4/torture/masktest.c34
-rw-r--r--source4/torture/nbench/nbench.c4
-rw-r--r--source4/torture/nbench/nbio.c22
-rw-r--r--source4/torture/rap/rap.c18
-rw-r--r--source4/torture/raw/chkpath.c30
-rw-r--r--source4/torture/raw/close.c10
-rw-r--r--source4/torture/raw/context.c44
-rw-r--r--source4/torture/raw/ioctl.c22
-rw-r--r--source4/torture/raw/lock.c62
-rw-r--r--source4/torture/raw/mkdir.c16
-rw-r--r--source4/torture/raw/mux.c48
-rw-r--r--source4/torture/raw/notify.c14
-rw-r--r--source4/torture/raw/open.c184
-rw-r--r--source4/torture/raw/oplock.c54
-rw-r--r--source4/torture/raw/qfileinfo.c14
-rw-r--r--source4/torture/raw/qfsinfo.c2
-rw-r--r--source4/torture/raw/read.c100
-rw-r--r--source4/torture/raw/rename.c40
-rw-r--r--source4/torture/raw/search.c28
-rw-r--r--source4/torture/raw/seek.c28
-rw-r--r--source4/torture/raw/setfileinfo.c34
-rw-r--r--source4/torture/raw/unlink.c18
-rw-r--r--source4/torture/raw/write.c112
-rw-r--r--source4/torture/torture.c1512
-rw-r--r--source4/torture/torture_util.c16
35 files changed, 1563 insertions, 1563 deletions
diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c
index 9fe2baa300..5da8d2643b 100644
--- a/source4/torture/basic/aliases.c
+++ b/source4/torture/basic/aliases.c
@@ -20,7 +20,7 @@
#include "includes.h"
-int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
+int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname);
struct trans2_blobs {
struct trans2_blobs *next, *prev;
@@ -29,7 +29,7 @@ struct trans2_blobs {
};
/* look for aliases for a query */
-static void gen_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_offset)
+static void gen_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int level_offset)
{
TALLOC_CTX *mem_ctx;
uint16_t level;
@@ -78,7 +78,7 @@ static void gen_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_
}
/* look for qfsinfo aliases */
-static void qfsinfo_aliases(struct cli_state *cli)
+static void qfsinfo_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_QFSINFO;
@@ -99,7 +99,7 @@ static void qfsinfo_aliases(struct cli_state *cli)
}
/* look for qfileinfo aliases */
-static void qfileinfo_aliases(struct cli_state *cli)
+static void qfileinfo_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_QFILEINFO;
@@ -118,25 +118,25 @@ static void qfileinfo_aliases(struct cli_state *cli)
t2.in.params = data_blob(NULL, 4);
t2.in.data = data_blob(NULL, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, cli->mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
SSVAL(t2.in.params.data, 0, fnum);
gen_aliases(cli, &t2, 2);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
}
/* look for qpathinfo aliases */
-static void qpathinfo_aliases(struct cli_state *cli)
+static void qpathinfo_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_QPATHINFO;
@@ -158,29 +158,29 @@ static void qpathinfo_aliases(struct cli_state *cli)
t2.in.params = data_blob_talloc(mem_ctx, NULL, 6);
t2.in.data = data_blob(NULL, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, cli->mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_close(cli->tree, fnum);
SIVAL(t2.in.params.data, 2, 0);
- cli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
+ smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
fname, STR_TERMINATE);
gen_aliases(cli, &t2, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
talloc_destroy(mem_ctx);
}
/* look for trans2 findfirst aliases */
-static void findfirst_aliases(struct cli_state *cli)
+static void findfirst_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_FINDFIRST;
@@ -202,14 +202,14 @@ static void findfirst_aliases(struct cli_state *cli)
t2.in.params = data_blob_talloc(mem_ctx, NULL, 12);
t2.in.data = data_blob(NULL, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, cli->mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_close(cli->tree, fnum);
SSVAL(t2.in.params.data, 0, 0);
SSVAL(t2.in.params.data, 2, 1);
@@ -217,19 +217,19 @@ static void findfirst_aliases(struct cli_state *cli)
SSVAL(t2.in.params.data, 6, 0);
SIVAL(t2.in.params.data, 8, 0);
- cli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
+ smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
fname, STR_TERMINATE);
gen_aliases(cli, &t2, 6);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
talloc_destroy(mem_ctx);
}
/* look for aliases for a set function */
-static void gen_set_aliases(struct cli_state *cli, struct smb_trans2 *t2, int level_offset)
+static void gen_set_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int level_offset)
{
TALLOC_CTX *mem_ctx;
uint16_t level;
@@ -295,7 +295,7 @@ static void gen_set_aliases(struct cli_state *cli, struct smb_trans2 *t2, int le
/* look for setfileinfo aliases */
-static void setfileinfo_aliases(struct cli_state *cli)
+static void setfileinfo_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_SETFILEINFO;
@@ -314,25 +314,25 @@ static void setfileinfo_aliases(struct cli_state *cli)
t2.in.params = data_blob(NULL, 6);
t2.in.data = data_blob(NULL, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, cli->mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
SSVAL(t2.in.params.data, 0, fnum);
SSVAL(t2.in.params.data, 4, 0);
gen_set_aliases(cli, &t2, 2);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
}
/* look for setpathinfo aliases */
-static void setpathinfo_aliases(struct cli_state *cli)
+static void setpathinfo_aliases(struct smbcli_state *cli)
{
struct smb_trans2 t2;
uint16_t setup = TRANSACT2_SETPATHINFO;
@@ -354,25 +354,25 @@ static void setpathinfo_aliases(struct cli_state *cli)
t2.in.params = data_blob_talloc(mem_ctx, NULL, 4);
t2.in.data = data_blob(NULL, 0);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, cli->mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- cli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_close(cli->tree, fnum);
SSVAL(t2.in.params.data, 2, 0);
- cli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
+ smbcli_blob_append_string(cli->session, mem_ctx, &t2.in.params,
fname, STR_TERMINATE);
gen_set_aliases(cli, &t2, 0);
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
- printf("unlink: %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
+ printf("unlink: %s\n", smbcli_errstr(cli->tree));
}
talloc_destroy(mem_ctx);
}
@@ -381,7 +381,7 @@ static void setpathinfo_aliases(struct cli_state *cli)
/* look for aliased info levels in trans2 calls */
BOOL torture_trans2_aliases(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
if (!torture_open_connection(&cli)) {
return False;
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 5febf873bd..d769501326 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -29,7 +29,7 @@
the prefix BASEDIR is added before the name
*/
-static NTSTATUS unicode_open(struct cli_tree *tree,
+static NTSTATUS unicode_open(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
uint32_t open_disposition,
const uint32_t *u_name,
@@ -90,7 +90,7 @@ static NTSTATUS unicode_open(struct cli_tree *tree,
/*
see if the server recognises composed characters
*/
-static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const uint32_t name1[] = {0x61, 0x308};
const uint32_t name2[] = {0xe4};
@@ -119,7 +119,7 @@ static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/*
see if the server recognises a naked diacritical
*/
-static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const uint32_t name1[] = {0x308};
const uint32_t name2[] = {0x308, 0x308};
@@ -150,7 +150,7 @@ static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/*
see if the server recognises a partial surrogate pair
*/
-static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const uint32_t name1[] = {0xd800};
const uint32_t name2[] = {0xdc00};
@@ -189,7 +189,7 @@ static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/*
see if the server recognises wide-a characters
*/
-static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const uint32_t name1[] = {'a'};
const uint32_t name2[] = {0xff41};
@@ -228,7 +228,7 @@ static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL torture_charset(int dummy)
{
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -240,12 +240,12 @@ BOOL torture_charset(int dummy)
printf("Starting charset tests\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c
index ec4a835240..66a1b37eec 100644
--- a/source4/torture/basic/denytest.c
+++ b/source4/torture/basic/denytest.c
@@ -1405,7 +1405,7 @@ static void progress_bar(uint_t i, uint_t total)
*/
BOOL torture_denytest1(int dummy)
{
- static struct cli_state *cli1;
+ static struct smbcli_state *cli1;
int fnum1, fnum2;
int i;
BOOL correct = True;
@@ -1421,10 +1421,10 @@ BOOL torture_denytest1(int dummy)
printf("Testing deny modes with 1 connection\n");
for (i=0;i<2;i++) {
- cli_unlink(cli1->tree, fnames[i]);
- fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
- cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
- cli_close(cli1->tree, fnum1);
+ smbcli_unlink(cli1->tree, fnames[i]);
+ fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
+ smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
+ smbcli_close(cli1->tree, fnum1);
}
printf("testing %d entries\n", ARRAY_SIZE(denytable1));
@@ -1437,10 +1437,10 @@ BOOL torture_denytest1(int dummy)
progress_bar(i, ARRAY_SIZE(denytable1));
- fnum1 = cli_open(cli1->tree, fname,
+ fnum1 = smbcli_open(cli1->tree, fname,
denytable1[i].mode1,
denytable1[i].deny1);
- fnum2 = cli_open(cli1->tree, fname,
+ fnum2 = smbcli_open(cli1->tree, fname,
denytable1[i].mode2,
denytable1[i].deny2);
@@ -1451,10 +1451,10 @@ BOOL torture_denytest1(int dummy)
} else {
char x = 1;
res = A_0;
- if (cli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
+ if (smbcli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
res += A_R;
}
- if (cli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+ if (smbcli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
res += A_W;
}
}
@@ -1479,12 +1479,12 @@ BOOL torture_denytest1(int dummy)
resultstr(denytable1[i].result));
}
- cli_close(cli1->tree, fnum1);
- cli_close(cli1->tree, fnum2);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli1->tree, fnum2);
}
for (i=0;i<2;i++) {
- cli_unlink(cli1->tree, fnames[i]);
+ smbcli_unlink(cli1->tree, fnames[i]);
}
if (!torture_close_connection(cli1)) {
@@ -1501,7 +1501,7 @@ BOOL torture_denytest1(int dummy)
*/
BOOL torture_denytest2(int dummy)
{
- static struct cli_state *cli1, *cli2;
+ static struct smbcli_state *cli1, *cli2;
int fnum1, fnum2;
int i;
BOOL correct = True;
@@ -1517,10 +1517,10 @@ BOOL torture_denytest2(int dummy)
printf("Testing deny modes with 2 connections\n");
for (i=0;i<2;i++) {
- cli_unlink(cli1->tree, fnames[i]);
- fnum1 = cli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
- cli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
- cli_close(cli1->tree, fnum1);
+ smbcli_unlink(cli1->tree, fnames[i]);
+ fnum1 = smbcli_open(cli1->tree, fnames[i], O_RDWR|O_CREAT, DENY_NONE);
+ smbcli_write(cli1->tree, fnum1, 0, fnames[i], 0, strlen(fnames[i]));
+ smbcli_close(cli1->tree, fnum1);
}
GetTimeOfDay(&tv_start);
@@ -1531,10 +1531,10 @@ BOOL torture_denytest2(int dummy)
progress_bar(i, ARRAY_SIZE(denytable1));
- fnum1 = cli_open(cli1->tree, fname,
+ fnum1 = smbcli_open(cli1->tree, fname,
denytable2[i].mode1,
denytable2[i].deny1);
- fnum2 = cli_open(cli2->tree, fname,
+ fnum2 = smbcli_open(cli2->tree, fname,
denytable2[i].mode2,
denytable2[i].deny2);
@@ -1545,10 +1545,10 @@ BOOL torture_denytest2(int dummy)
} else {
char x = 1;
res = A_0;
- if (cli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
+ if (smbcli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
res += A_R;
}
- if (cli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+ if (smbcli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
res += A_W;
}
}
@@ -1573,12 +1573,12 @@ BOOL torture_denytest2(int dummy)
resultstr(denytable2[i].result));
}
- cli_close(cli1->tree, fnum1);
- cli_close(cli2->tree, fnum2);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli2->tree, fnum2);
}
for (i=0;i<2;i++) {
- cli_unlink(cli1->tree, fnames[i]);
+ smbcli_unlink(cli1->tree, fnames[i]);
}
if (!torture_close_connection(cli1)) {
diff --git a/source4/torture/basic/dfstest.c b/source4/torture/basic/dfstest.c
index 79d49aded3..eb2d517f6d 100644
--- a/source4/torture/basic/dfstest.c
+++ b/source4/torture/basic/dfstest.c
@@ -23,7 +23,7 @@
#define DFS_SERVER_COUNT 6
#define DFS_FILE_COUNT 8
extern char *host, *share, *password, *username;
-static struct cli_client context;
+static struct smbcli_client context;
static const char *sockops="TCP_NODELAY";
/*
@@ -39,59 +39,59 @@ BOOL torture_dfs_basic(int dummy)
const char *template = "\\\\%s\\%s\\dfstest%d.tmp";
char *filedata;
int server_count = 0;
- int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
- | CLI_FULL_CONNECTION_USE_DFS
+ int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+ | SMBCLI_FULL_CONNECTION_USE_DFS
;
printf("starting dfs_basic_test\n");
- cli_client_initialize(&context, sockops, username, password, lp_workgroup(), connection_flags);
+ smbcli_client_initialize(&context, sockops, username, password, lp_workgroup(), connection_flags);
- if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags) < 0))
+ if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags) < 0))
return False;
for (i=0; i < DFS_FILE_COUNT ; i++) {
file_server[i] = 0;
DEBUG(4,("host=%s share=%s cli host=%s cli share=%s\n",
- host, share, cli_state_get_host(context.cli[file_server[i]]),
- cli_state_get_share(context.cli[file_server[i]])));
- host = cli_state_get_host(context.cli[file_server[i]]);
- share = cli_state_get_share(context.cli[file_server[i]]);
+ host, share, smbcli_state_get_host(context.cli[file_server[i]]),
+ smbcli_state_get_share(context.cli[file_server[i]])));
+ host = smbcli_state_get_host(context.cli[file_server[i]]);
+ share = smbcli_state_get_share(context.cli[file_server[i]]);
asprintf(&fname[i], template, host, share, i);
DEBUG(3,("unlinking %s\n", fname[i]));
- cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+ smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
}
for (i=0; i < DFS_FILE_COUNT ; i++) {
- host = cli_state_get_host(context.cli[file_server[i]]);
- share = cli_state_get_share(context.cli[file_server[i]]);
+ host = smbcli_state_get_host(context.cli[file_server[i]]);
+ share = smbcli_state_get_share(context.cli[file_server[i]]);
asprintf(&fname[i], template, host, share, i);
DEBUG(3,("open %s on server %s(%d)\n",
fname[i], host, file_server[i]));
- fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum[i] == -1)
{
- printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
asprintf(&filedata, "%s %d", fname[i], fnum[i]);
DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(filedata), filedata, fname[i], fnum[i],
host, file_server[i]));
- if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+ if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
return False;
}
- if (!cli_close(context.cli[file_server[i]], fnum[i])) {
- printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+ printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
}
DEBUG(3,("used Dfs servers:"));
for (i=0; i < DFS_SERVER_COUNT ; i++) {
server_count++;
- DEBUG(3,(" %s(%d)", cli_state_get_host(context.cli[file_server[i]]), i));
+ DEBUG(3,(" %s(%d)", smbcli_state_get_host(context.cli[file_server[i]]), i));
if (!torture_close_connection(context.cli[i]))
return False;
}
@@ -119,63 +119,63 @@ BOOL torture_dfs_rename(int dummy)
const char *template2new = "\\\\%s\\%s\\~dfstestnew.txt";
char *filedata, *newdata;
int server_count = 0;
- int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
- | CLI_FULL_CONNECTION_USE_DFS
+ int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+ | SMBCLI_FULL_CONNECTION_USE_DFS
;
printf("starting dfs_rename_test\n");
- cli_client_initialize(&context, sockops, username, password,
+ smbcli_client_initialize(&context, sockops, username, password,
lp_workgroup(), connection_flags);
- if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+ if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
return False;
for (i=0; i < DFS_FILE_COUNT ; i++) {
file_server[i] = 0;
slprintf(fname[i],sizeof(fstring)-1,template, host, share, i);
DEBUG(3,("unlinking %s\n", fname[i]));
- cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+ smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
}
/* Simple rename test */
for (i=0; i < 1 ; i++) {
slprintf(fname[i],sizeof(fstring)-1,template,
- cli_state_get_host(context.cli[file_server[i]]),
- cli_state_get_share(context.cli[file_server[i]]), i);
+ smbcli_state_get_host(context.cli[file_server[i]]),
+ smbcli_state_get_share(context.cli[file_server[i]]), i);
DEBUG(3,("open %s on server %s(%d)\n",
- fname[i], cli_state_get_host(context.cli[file_server[i]]), file_server[i]));
+ fname[i], smbcli_state_get_host(context.cli[file_server[i]]), file_server[i]));
- fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum[i] == -1) {
- printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
asprintf(&filedata, "%s %d", fname[i], (int)getpid());
DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(filedata), filedata, fname[i], fnum[i],
- cli_state_get_host(context.cli[file_server[i]]), file_server[i]));
- if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+ smbcli_state_get_host(context.cli[file_server[i]]), file_server[i]));
+ if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
return False;
}
- if (!cli_close(context.cli[file_server[i]], fnum[i])) {
- printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+ printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
}
// now attempt to rename the file
DEBUG(3,("rename %s to %s on server %s(%d)\n",
- fname[0], fname[1], cli_state_get_host(context.cli[file_server[i]]), file_server[0]));
- if (!cli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
- printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], cli_errstr(context.cli[file_server[0]]));
+ fname[0], fname[1], smbcli_state_get_host(context.cli[file_server[i]]), file_server[0]));
+ if (!smbcli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
+ printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], smbcli_errstr(context.cli[file_server[0]]));
return False;
}
// clean up
DEBUG(3,("used Dfs servers:"));
for (i=0; i < DFS_SERVER_COUNT ; i++) {
server_count++;
- DEBUG(3,(" %s(%d)", cli_state_get_host(context.cli[file_server[i]]), i));
+ DEBUG(3,(" %s(%d)", smbcli_state_get_host(context.cli[file_server[i]]), i));
if (!torture_close_connection(context.cli[i]))
return False;
}
@@ -187,10 +187,10 @@ BOOL torture_dfs_rename(int dummy)
* Then open, write to new temp name file (~x.new), close.
* Then rename old file name to old temp name file (~x.old).
* Then rename new temp name file to oroginal name (x). */
- cli_client_initialize(&context, sockops, username, password,
+ smbcli_client_initialize(&context, sockops, username, password,
lp_workgroup(), connection_flags);
- if ((current_server = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+ if ((current_server = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
return False;
slprintf(fname[0],sizeof(fname[0])-1,template2orig, host, share);
slprintf(fname[1],sizeof(fname[1])-1,template2old, host, share);
@@ -199,99 +199,99 @@ BOOL torture_dfs_rename(int dummy)
file_server[i] = 0;
fnum[i] = 0;
DEBUG(3,("unlinking %s\n", fname[i]));
- cli_nt_unlink(&context, &file_server[i], fname[i], 0);
+ smbcli_nt_unlink(&context, &file_server[i], fname[i], 0);
}
asprintf(&fname[0],template2orig,
- cli_state_get_host(context.cli[0]),
- cli_state_get_share(context.cli[0]), 0);
+ smbcli_state_get_host(context.cli[0]),
+ smbcli_state_get_share(context.cli[0]), 0);
asprintf(&fname[1],template2old,
- cli_state_get_host(context.cli[1]),
- cli_state_get_share(context.cli[1]), 1);
+ smbcli_state_get_host(context.cli[1]),
+ smbcli_state_get_share(context.cli[1]), 1);
asprintf(&fname[2],template2new,
- cli_state_get_host(context.cli[2]),
- cli_state_get_share(context.cli[2]), 2);
+ smbcli_state_get_host(context.cli[2]),
+ smbcli_state_get_share(context.cli[2]), 2);
DEBUG(3,("edit(MS Word) %s on server %s(%d)\n",
- fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
+ fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
DEBUG(3,("open %s on server %s(%d)\n",
- fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
+ fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
- fnum[0] = cli_dfs_open(&context, &file_server[0], fname[0], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum[0] = smbcli_dfs_open(&context, &file_server[0], fname[0], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum[0] == -1)
{
- printf("open of %s failed (%s)\n", fname[0], cli_errstr(context.cli[file_server[0]]));
+ printf("open of %s failed (%s)\n", fname[0], smbcli_errstr(context.cli[file_server[0]]));
return False;
}
slprintf(filedata, sizeof(fstring)-1, "%s %d", fname[0], (int)getpid());
DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(filedata), filedata, fname[0], fnum[0],
- cli_state_get_host(context.cli[0]), file_server[0]));
- if (cli_write(context.cli[file_server[0]], fnum[0], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+ smbcli_state_get_host(context.cli[0]), file_server[0]));
+ if (smbcli_write(context.cli[file_server[0]], fnum[0], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[0]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[0]]));
return False;
}
// read data from original file
DEBUG(3,("read %s (fid %d) on server %s(%d)\n",
- fname[0], fnum[0], cli_state_get_host(context.cli[0]), file_server[0]));
- if (cli_read(context.cli[file_server[0]], fnum[0], filedata, 0, strlen(filedata)) != strlen(filedata))
+ fname[0], fnum[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
+ if (smbcli_read(context.cli[file_server[0]], fnum[0], filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("read failed (%s)", cli_errstr(context.cli[file_server[0]]));
+ printf("read failed (%s)", smbcli_errstr(context.cli[file_server[0]]));
return False;
}
DEBUG(3,("close %s on server %s(%d)\n",
- fname[0], cli_state_get_host(context.cli[0]), file_server[0]));
- if (!cli_close(context.cli[file_server[0]], fnum[0])) {
- printf("close of %s failed (%s)\n", fname[0], cli_errstr(context.cli[file_server[0]]));
+ fname[0], smbcli_state_get_host(context.cli[0]), file_server[0]));
+ if (!smbcli_close(context.cli[file_server[0]], fnum[0])) {
+ printf("close of %s failed (%s)\n", fname[0], smbcli_errstr(context.cli[file_server[0]]));
return False;
}
// open new temp file, write data
DEBUG(3,("open %s on server %s(%d)\n",
- fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
- fnum[2] = cli_dfs_open(&context, &file_server[2], fname[2], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
+ fnum[2] = smbcli_dfs_open(&context, &file_server[2], fname[2], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum[2] == -1)
{
- printf("open of %s failed (%s)\n", fname[2], cli_errstr(context.cli[file_server[2]]));
+ printf("open of %s failed (%s)\n", fname[2], smbcli_errstr(context.cli[file_server[2]]));
return False;
}
DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(filedata), filedata, fname[2], fnum[2],
- cli_state_get_host(context.cli[2]), file_server[2]));
- if (cli_write(context.cli[file_server[2]], fnum[2], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+ smbcli_state_get_host(context.cli[2]), file_server[2]));
+ if (smbcli_write(context.cli[file_server[2]], fnum[2], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[2]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[2]]));
return False;
}
slprintf(newdata, sizeof(fstring)-1, "new data: %s %d", fname[0], (int)getpid());
DEBUG(3,("write new data %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(newdata), newdata, fname[2], fnum[2],
- cli_state_get_host(context.cli[2]), file_server[2]));
- if (cli_write(context.cli[file_server[2]], fnum[2], 0, newdata, strlen(filedata), strlen(newdata)) != strlen(newdata))
+ smbcli_state_get_host(context.cli[2]), file_server[2]));
+ if (smbcli_write(context.cli[file_server[2]], fnum[2], 0, newdata, strlen(filedata), strlen(newdata)) != strlen(newdata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[2]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[2]]));
return False;
}
DEBUG(3,("close %s on server %s(%d)\n",
- fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
- if (!cli_close(context.cli[file_server[2]], fnum[2])) {
- printf("close of %s failed (%s)\n", fname[2], cli_errstr(context.cli[file_server[2]]));
+ fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
+ if (!smbcli_close(context.cli[file_server[2]], fnum[2])) {
+ printf("close of %s failed (%s)\n", fname[2], smbcli_errstr(context.cli[file_server[2]]));
return False;
}
DEBUG(3,("close successful %s on server %s(%d)\n",
- fname[2], cli_state_get_host(context.cli[2]), file_server[2]));
+ fname[2], smbcli_state_get_host(context.cli[2]), file_server[2]));
// rename original file to temp
DEBUG(4,("file_server[0]=%d\n", file_server[0]));
- DEBUG(4,("context.cli[file_server[0]].desthost=%s\n", cli_state_get_host(context.cli[0])));
+ DEBUG(4,("context.cli[file_server[0]].desthost=%s\n", smbcli_state_get_host(context.cli[0])));
DEBUG(3,("rename %s to %s on server %s(%d)\n",
- fname[0], fname[1], cli_state_get_host(context.cli[0]), file_server[0]));
- if (!cli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
- printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], cli_errstr(context.cli[file_server[0]]));
+ fname[0], fname[1], smbcli_state_get_host(context.cli[0]), file_server[0]));
+ if (!smbcli_dfs_rename(&context, &file_server[0], fname[0], fname[1])) {
+ printf("rename of %s to %s failed (%s)\n", fname[0], fname[1], smbcli_errstr(context.cli[file_server[0]]));
return False;
}
// name new temp file to original
DEBUG(3,("rename %s to %s on server %s(%d)\n",
- fname[2], fname[0], cli_state_get_host(context.cli[2]), file_server[2]));
- if (!cli_dfs_rename(&context, &file_server[2], fname[2], fname[0])) {
- printf("rename of %s to %s failed (%s)\n", fname[2], fname[0], cli_errstr(context.cli[file_server[2]]));
+ fname[2], fname[0], smbcli_state_get_host(context.cli[2]), file_server[2]));
+ if (!smbcli_dfs_rename(&context, &file_server[2], fname[2], fname[0])) {
+ printf("rename of %s to %s failed (%s)\n", fname[2], fname[0], smbcli_errstr(context.cli[file_server[2]]));
return False;
}
printf("Dfstest: passed MS Word rename test\n");
@@ -299,7 +299,7 @@ BOOL torture_dfs_rename(int dummy)
DEBUG(3,("used Dfs servers:"));
for (i=0; i < DFS_SERVER_COUNT ; i++) {
server_count++;
- DEBUG(3,(" %s(%d)", cli_state_get_host(context.cli[i]), i));
+ DEBUG(3,(" %s(%d)", smbcli_state_get_host(context.cli[i]), i));
if (!torture_close_connection(context.cli[i]))
return False;
}
@@ -309,7 +309,7 @@ BOOL torture_dfs_rename(int dummy)
return True;
}
struct list_fn_parms {
- struct cli_client *context;
+ struct smbcli_client *context;
char* rname;
} list_fn_parms;
@@ -321,7 +321,7 @@ void delete_file(file_info *finfo, const char *rname)
DEBUG(3,("deleting file %s in %s\n", finfo->name, rname));
asprintf(&fname, "%s\\%s", rname, finfo->name);
- cli_nt_unlink(&context, &server, fname, 0);
+ smbcli_nt_unlink(&context, &server, fname, 0);
}
void delete_directory(file_info *finfo, const char *rname)
{
@@ -330,12 +330,12 @@ void delete_directory(file_info *finfo, const char *rname)
DEBUG(3,("deleting directory %s in %s\n", finfo->name, rname));
asprintf(&dname, "%s%s\\*", rname, finfo->name);
- cli_nt_unlink(&context, &server, dname, 0);
+ smbcli_nt_unlink(&context, &server, dname, 0);
asprintf(&dname, "%s%s\\*", rname, finfo->name);
asprintf(&rname2, "%s%s", rname, finfo->name);
- cli_search(context.cli[0], dname, FILE_ATTRIBUTE_DIRECTORY,
+ smbcli_search(context.cli[0], dname, FILE_ATTRIBUTE_DIRECTORY,
dfs_list_fn, (void*)rname2);
- cli_dfs_rmdir(&context, &server, rname2);
+ smbcli_dfs_rmdir(&context, &server, rname2);
}
void dfs_list_fn(file_info *finfo, const char *name, void* parmsp)
@@ -371,47 +371,47 @@ BOOL torture_dfs_random(int dummy)
char *filedata;
int server_count = 0;
int file_count;
- int connection_flags = CLI_FULL_CONNECTION_USE_KERBEROS
- | CLI_FULL_CONNECTION_USE_DFS
+ int connection_flags = SMBCLI_FULL_CONNECTION_USE_KERBEROS
+ | SMBCLI_FULL_CONNECTION_USE_DFS
;
printf("starting dfs_random_test\n");
- cli_client_initialize(&context, sockops, username, password,
+ smbcli_client_initialize(&context, sockops, username, password,
lp_workgroup(), connection_flags);
- if ((dir_server[0] = cli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
+ if ((dir_server[0] = smbcli_dfs_open_connection(&context, host, share, connection_flags)) < 0)
return False;
// get list of directories named dfsdir*.
// delete all files in these directories using wild card,
// then delete directory.
asprintf(&rname, "\\\\%s\\%s\\",
- cli_state_get_host(context.cli[0]),
- cli_state_get_share(context.cli[0]));
+ smbcli_state_get_host(context.cli[0]),
+ smbcli_state_get_share(context.cli[0]));
asprintf(&fname[0], alltemplate,
- cli_state_get_host(context.cli[0]),
- cli_state_get_share(context.cli[0]));
+ smbcli_state_get_host(context.cli[0]),
+ smbcli_state_get_share(context.cli[0]));
DEBUG(3,("deleting files %s in %s on server %s(%d)\n",
- fname[0], rname, cli_state_get_host(context.cli[0]), dir_server[0]));
- file_count = cli_search(context.cli[0], fname[0], FILE_ATTRIBUTE_DIRECTORY, dfs_list_fn, (void*)rname);
+ fname[0], rname, smbcli_state_get_host(context.cli[0]), dir_server[0]));
+ file_count = smbcli_search(context.cli[0], fname[0], FILE_ATTRIBUTE_DIRECTORY, dfs_list_fn, (void*)rname);
// create random directory names with 0-n levels
asprintf(&dname[0], "\\\\%s\\%s\\",
- cli_state_get_host(context.cli[0]),
- cli_state_get_share(context.cli[0]));
+ smbcli_state_get_host(context.cli[0]),
+ smbcli_state_get_share(context.cli[0]));
DEBUG(3,("creating directories in %s on server %s(%d)\n",
- rname, cli_state_get_host(context.cli[0]), dir_server[0]));
+ rname, smbcli_state_get_host(context.cli[0]), dir_server[0]));
for (i=1; i < DFS_RANDOM_DIR_COUNT; i++) {
dir_server[i] = 0;
asprintf(&dname[i],
"\\\\%s\\%s\\dfsdir%d.tmp",
- cli_state_get_host(context.cli[dir_server[i]]),
- cli_state_get_share(context.cli[dir_server[i]]),
+ smbcli_state_get_host(context.cli[dir_server[i]]),
+ smbcli_state_get_share(context.cli[dir_server[i]]),
(int)sys_random()%10000);
DEBUG(3,("mkdir %s on server %s(%d)\n",
- dname[i], cli_state_get_host(context.cli[dir_server[i]]), dir_server[i]));
- if (!cli_dfs_mkdir(&context, &dir_server[i], dname[i])) {
- printf("mkdir of %s failed (%s)\n", dname[i], cli_errstr(context.cli[dir_server[i]]));
+ dname[i], smbcli_state_get_host(context.cli[dir_server[i]]), dir_server[i]));
+ if (!smbcli_dfs_mkdir(&context, &dir_server[i], dname[i])) {
+ printf("mkdir of %s failed (%s)\n", dname[i], smbcli_errstr(context.cli[dir_server[i]]));
return False;
}
}
@@ -422,33 +422,33 @@ BOOL torture_dfs_random(int dummy)
file_server[i] = dir_server[dn];
asprintf(&fname[i], ftemplate, dname[dn], i);
DEBUG(3,("open %s on server %s(%d)\n",
- fname[i], cli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
- fnum[i] = cli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fname[i], smbcli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
+ fnum[i] = smbcli_dfs_open(&context, &file_server[i], fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum[i] == -1)
{
- printf("open of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ printf("open of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
asprintf(&filedata, "%s %d", fname[i], fnum[i]);
DEBUG(3,("write %d bytes (%s) to %s (fid %d) on server %s(%d)\n",
strlen(filedata), filedata, fname[i], fnum[i],
- cli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
- if (cli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
+ smbcli_state_get_host(context.cli[dir_server[i]]), file_server[i]));
+ if (smbcli_write(context.cli[file_server[i]], fnum[i], 0, filedata, 0, strlen(filedata)) != strlen(filedata))
{
- printf("write failed (%s)\n", cli_errstr(context.cli[file_server[i]]));
+ printf("write failed (%s)\n", smbcli_errstr(context.cli[file_server[i]]));
return False;
}
- if (!cli_close(context.cli[file_server[i]], fnum[i])) {
- printf("close of %s failed (%s)\n", fname[i], cli_errstr(context.cli[file_server[i]]));
+ if (!smbcli_close(context.cli[file_server[i]], fnum[i])) {
+ printf("close of %s failed (%s)\n", fname[i], smbcli_errstr(context.cli[file_server[i]]));
return False;
}
}
DEBUG(3,("used Dfs servers:"));
for (i=0; i < DFS_SERVER_COUNT ; i++) {
server_count++;
- DEBUG(3,(" %s(%d)", cli_state_get_host(context.cli[i]), i));
+ DEBUG(3,(" %s(%d)", smbcli_state_get_host(context.cli[i]), i));
if (!torture_close_connection(context.cli[i]))
return False;
}
diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c
index 4859ee7c4c..c0c77f950f 100644
--- a/source4/torture/basic/mangle_test.c
+++ b/source4/torture/basic/mangle_test.c
@@ -26,7 +26,7 @@ static TDB_CONTEXT *tdb;
static uint_t total, collisions, failures;
-static BOOL test_one(struct cli_state *cli, const char *name)
+static BOOL test_one(struct smbcli_state *cli, const char *name)
{
int fnum;
const char *shortname;
@@ -36,48 +36,48 @@ static BOOL test_one(struct cli_state *cli, const char *name)
total++;
- fnum = cli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum = smbcli_open(cli->tree, name, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
- printf("open of %s failed (%s)\n", name, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
- printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+ printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
return False;
}
/* get the short name */
- status = cli_qpathinfo_alt_name(cli->tree, name, &shortname);
+ status = smbcli_qpathinfo_alt_name(cli->tree, name, &shortname);
if (!NT_STATUS_IS_OK(status)) {
- printf("query altname of %s failed (%s)\n", name, cli_errstr(cli->tree));
+ printf("query altname of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
return False;
}
snprintf(name2, sizeof(name2), "\\mangle_test\\%s", shortname);
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name2))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name2))) {
printf("unlink of %s (%s) failed (%s)\n",
- name2, name, cli_errstr(cli->tree));
+ name2, name, smbcli_errstr(cli->tree));
return False;
}
/* recreate by short name */
- fnum = cli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum = smbcli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
- printf("open2 of %s failed (%s)\n", name2, cli_errstr(cli->tree));
+ printf("open2 of %s failed (%s)\n", name2, smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
- printf("close of %s failed (%s)\n", name, cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+ printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree));
return False;
}
/* and unlink by long name */
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, name))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name))) {
printf("unlink2 of %s (%s) failed (%s)\n",
- name, name2, cli_errstr(cli->tree));
+ name, name2, smbcli_errstr(cli->tree));
failures++;
- cli_unlink(cli->tree, name2);
+ smbcli_unlink(cli->tree, name2);
return True;
}
@@ -151,7 +151,7 @@ static void gen_name(char *name)
BOOL torture_mangle(int dummy)
{
extern int torture_numops;
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
int i;
printf("starting mangle test\n");
@@ -167,10 +167,10 @@ BOOL torture_mangle(int dummy)
return False;
}
- cli_unlink(cli->tree, "\\mangle_test\\*");
- cli_rmdir(cli->tree, "\\mangle_test");
+ smbcli_unlink(cli->tree, "\\mangle_test\\*");
+ smbcli_rmdir(cli->tree, "\\mangle_test");
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\mangle_test"))) {
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\mangle_test"))) {
printf("ERROR: Failed to make directory\n");
return False;
}
@@ -189,8 +189,8 @@ BOOL torture_mangle(int dummy)
}
}
- cli_unlink(cli->tree, "\\mangle_test\\*");
- if (NT_STATUS_IS_ERR(cli_rmdir(cli->tree, "\\mangle_test"))) {
+ smbcli_unlink(cli->tree, "\\mangle_test\\*");
+ if (NT_STATUS_IS_ERR(smbcli_rmdir(cli->tree, "\\mangle_test"))) {
printf("ERROR: Failed to remove directory\n");
return False;
}
diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c
index 20a467100b..f8a0539f1e 100644
--- a/source4/torture/basic/scanner.c
+++ b/source4/torture/basic/scanner.c
@@ -45,7 +45,7 @@ static void trans2_check_hit(const char *format, int op, int level, NTSTATUS sta
/****************************************************************************
check for existance of a trans2 call
****************************************************************************/
-static NTSTATUS try_trans2(struct cli_state *cli,
+static NTSTATUS try_trans2(struct smbcli_state *cli,
int op,
char *param, char *data,
int param_len, int data_len,
@@ -81,7 +81,7 @@ static NTSTATUS try_trans2(struct cli_state *cli,
}
-static NTSTATUS try_trans2_len(struct cli_state *cli,
+static NTSTATUS try_trans2_len(struct smbcli_state *cli,
const char *format,
int op, int level,
char *param, char *data,
@@ -117,7 +117,7 @@ static NTSTATUS try_trans2_len(struct cli_state *cli,
/****************************************************************************
check whether a trans2 opnum exists at all
****************************************************************************/
-static BOOL trans2_op_exists(struct cli_state *cli, int op)
+static BOOL trans2_op_exists(struct smbcli_state *cli, int op)
{
int data_len = 0;
int param_len = 0;
@@ -151,7 +151,7 @@ static BOOL trans2_op_exists(struct cli_state *cli, int op)
/****************************************************************************
check for existance of a trans2 call
****************************************************************************/
-static BOOL scan_trans2(struct cli_state *cli, int op, int level,
+static BOOL scan_trans2(struct smbcli_state *cli, int op, int level,
int fnum, int dnum, int qfnum, const char *fname)
{
int data_len = 0;
@@ -217,19 +217,19 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
status = try_trans2_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_unlink(cli->tree, "\\newfile.dat");
- cli_rmdir(cli->tree, "\\newfile.dat");
+ smbcli_unlink(cli->tree, "\\newfile.dat");
+ smbcli_rmdir(cli->tree, "\\newfile.dat");
if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */
- cli_mkdir(cli->tree, "\\testdir");
+ smbcli_mkdir(cli->tree, "\\testdir");
param_len = 2;
SSVAL(param, 0, level);
param_len += push_string(NULL, &param[2], "\\testdir", sizeof(pstring)-3, STR_TERMINATE|STR_UNICODE);
status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_rmdir(cli->tree, "\\testdir");
+ smbcli_rmdir(cli->tree, "\\testdir");
if (NT_STATUS_IS_OK(status)) return True;
return False;
@@ -238,7 +238,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
BOOL torture_trans2_scan(int dummy)
{
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
int op, level;
const char *fname = "\\scanner.dat";
int fnum, dnum, qfnum;
@@ -249,19 +249,19 @@ BOOL torture_trans2_scan(int dummy)
return False;
}
- fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
if (fnum == -1) {
- printf("file open failed - %s\n", cli_errstr(cli->tree));
+ printf("file open failed - %s\n", smbcli_errstr(cli->tree));
}
- dnum = cli_nt_create_full(cli->tree, "\\",
+ dnum = smbcli_nt_create_full(cli->tree, "\\",
0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE,
NTCREATEX_DISP_OPEN,
NTCREATEX_OPTIONS_DIRECTORY, 0);
if (dnum == -1) {
- printf("directory open failed - %s\n", cli_errstr(cli->tree));
+ printf("directory open failed - %s\n", smbcli_errstr(cli->tree));
}
- qfnum = cli_nt_create_full(cli->tree, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION",
+ qfnum = smbcli_nt_create_full(cli->tree, "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION",
NTCREATEX_FLAGS_EXTENDED,
SEC_RIGHTS_MAXIMUM_ALLOWED,
0,
@@ -269,7 +269,7 @@ BOOL torture_trans2_scan(int dummy)
NTCREATEX_DISP_OPEN,
0, 0);
if (qfnum == -1) {
- printf("quota open failed - %s\n", cli_errstr(cli->tree));
+ printf("quota open failed - %s\n", smbcli_errstr(cli->tree));
}
for (op=OP_MIN; op<=OP_MAX; op++) {
@@ -321,7 +321,7 @@ static void nttrans_check_hit(const char *format, int op, int level, NTSTATUS st
/****************************************************************************
check for existence of a nttrans call
****************************************************************************/
-static NTSTATUS try_nttrans(struct cli_state *cli,
+static NTSTATUS try_nttrans(struct smbcli_state *cli,
int op,
char *param, char *data,
int param_len, int data_len,
@@ -363,7 +363,7 @@ static NTSTATUS try_nttrans(struct cli_state *cli,
}
-static NTSTATUS try_nttrans_len(struct cli_state *cli,
+static NTSTATUS try_nttrans_len(struct smbcli_state *cli,
const char *format,
int op, int level,
char *param, char *data,
@@ -398,7 +398,7 @@ static NTSTATUS try_nttrans_len(struct cli_state *cli,
/****************************************************************************
check for existance of a nttrans call
****************************************************************************/
-static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
+static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level,
int fnum, int dnum, const char *fname)
{
int data_len = 0;
@@ -456,19 +456,19 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
status = try_nttrans_len(cli, "newfile", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_unlink(cli->tree, "\\newfile.dat");
- cli_rmdir(cli->tree, "\\newfile.dat");
+ smbcli_unlink(cli->tree, "\\newfile.dat");
+ smbcli_rmdir(cli->tree, "\\newfile.dat");
if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */
- cli_mkdir(cli->tree, "\\testdir");
+ smbcli_mkdir(cli->tree, "\\testdir");
param_len = 2;
SSVAL(param, 0, level);
param_len += push_string(NULL, &param[2], "\\testdir", -1, STR_TERMINATE | STR_UNICODE);
status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- cli_rmdir(cli->tree, "\\testdir");
+ smbcli_rmdir(cli->tree, "\\testdir");
if (NT_STATUS_IS_OK(status)) return True;
return False;
@@ -477,7 +477,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
BOOL torture_nttrans_scan(int dummy)
{
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
int op, level;
const char *fname = "\\scanner.dat";
int fnum, dnum;
@@ -488,9 +488,9 @@ BOOL torture_nttrans_scan(int dummy)
return False;
}
- fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
+ fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
DENY_NONE);
- dnum = cli_open(cli->tree, "\\", O_RDONLY, DENY_NONE);
+ dnum = smbcli_open(cli->tree, "\\", O_RDONLY, DENY_NONE);
for (op=OP_MIN; op<=OP_MAX; op++) {
printf("Scanning op=%d\n", op);
@@ -517,9 +517,9 @@ BOOL torture_nttrans_scan(int dummy)
/* scan for valid base SMB requests */
BOOL torture_smb_scan(int dummy)
{
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
int op;
- struct cli_request *req;
+ struct smbcli_request *req;
NTSTATUS status;
for (op=0x0;op<=0xFF;op++) {
@@ -529,30 +529,30 @@ BOOL torture_smb_scan(int dummy)
return False;
}
- req = cli_request_setup(cli->tree, op, 0, 0);
+ req = smbcli_request_setup(cli->tree, op, 0, 0);
- if (!cli_request_send(req)) {
- cli_request_destroy(req);
+ if (!smbcli_request_send(req)) {
+ smbcli_request_destroy(req);
break;
}
usleep(10000);
- cli_transport_process(cli->transport);
- if (req->state > CLI_REQUEST_RECV) {
- status = cli_request_simple_recv(req);
+ smbcli_transport_process(cli->transport);
+ if (req->state > SMBCLI_REQUEST_RECV) {
+ status = smbcli_request_simple_recv(req);
printf("op=0x%x status=%s\n", op, nt_errstr(status));
torture_close_connection(cli);
continue;
}
sleep(1);
- cli_transport_process(cli->transport);
- if (req->state > CLI_REQUEST_RECV) {
- status = cli_request_simple_recv(req);
+ smbcli_transport_process(cli->transport);
+ if (req->state > SMBCLI_REQUEST_RECV) {
+ status = smbcli_request_simple_recv(req);
printf("op=0x%x status=%s\n", op, nt_errstr(status));
} else {
printf("op=0x%x no reply\n", op);
- cli_request_destroy(req);
+ smbcli_request_destroy(req);
continue; /* don't attempt close! */
}
diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c
index 08cc4bb9b0..f98e1b1b4a 100644
--- a/source4/torture/basic/utable.c
+++ b/source4/torture/basic/utable.c
@@ -22,7 +22,7 @@
BOOL torture_utable(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
fstring fname;
const char *alt_name;
int fnum;
@@ -41,8 +41,8 @@ BOOL torture_utable(int dummy)
memset(valid, 0, sizeof(valid));
- cli_mkdir(cli->tree, "\\utable");
- cli_unlink(cli->tree, "\\utable\\*");
+ smbcli_mkdir(cli->tree, "\\utable");
+ smbcli_unlink(cli->tree, "\\utable\\*");
for (c=1; c < 0x10000; c++) {
char *p;
@@ -56,13 +56,13 @@ BOOL torture_utable(int dummy)
p[len] = 0;
fstrcat(fname,"_a_long_extension");
- fnum = cli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
+ fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC,
DENY_NONE);
if (fnum == -1) continue;
chars_allowed++;
- cli_qpathinfo_alt_name(cli->tree, fname, &alt_name);
+ smbcli_qpathinfo_alt_name(cli->tree, fname, &alt_name);
if (strncmp(alt_name, "X_A_L", 5) != 0) {
alt_allowed++;
@@ -70,8 +70,8 @@ BOOL torture_utable(int dummy)
d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name);
}
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
if (c % 100 == 0) {
printf("%d (%d/%d)\r", c, chars_allowed, alt_allowed);
@@ -79,7 +79,7 @@ BOOL torture_utable(int dummy)
}
printf("%d (%d/%d)\n", c, chars_allowed, alt_allowed);
- cli_rmdir(cli->tree, "\\utable");
+ smbcli_rmdir(cli->tree, "\\utable");
d_printf("%d chars allowed %d alt chars allowed\n", chars_allowed, alt_allowed);
@@ -116,7 +116,7 @@ static char *form_name(int c)
BOOL torture_casetable(int dummy)
{
- static struct cli_state *cli;
+ static struct smbcli_state *cli;
char *fname;
int fnum;
int c, i;
@@ -132,8 +132,8 @@ BOOL torture_casetable(int dummy)
memset(equiv, 0, sizeof(equiv));
- cli_deltree(cli->tree, "\\utable");
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\utable"))) {
+ smbcli_deltree(cli->tree, "\\utable");
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\utable"))) {
printf("Failed to create utable directory!\n");
return False;
}
@@ -146,7 +146,7 @@ BOOL torture_casetable(int dummy)
d_printf("%04x (%c)\n", c, isprint(c)?c:'.');
fname = form_name(c);
- fnum = cli_nt_create_full(cli->tree, fname, 0,
+ fnum = smbcli_nt_create_full(cli->tree, fname, 0,
#if 0
SEC_RIGHT_MAXIMUM_ALLOWED,
#else
@@ -163,7 +163,7 @@ BOOL torture_casetable(int dummy)
size = 0;
- if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size,
+ if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size,
NULL, NULL, NULL, NULL, NULL))) continue;
if (size > 0) {
@@ -173,11 +173,11 @@ BOOL torture_casetable(int dummy)
if (size/sizeof(int) >= MAX_EQUIVALENCE) {
printf("too many chars match?? size=%d c=0x%04x\n",
size, c);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
return False;
}
- cli_read(cli->tree, fnum, (char *)c2, 0, size);
+ smbcli_read(cli->tree, fnum, (char *)c2, 0, size);
printf("%04x: ", c);
equiv[c][0] = c;
for (i=0; i<size/sizeof(int); i++) {
@@ -188,12 +188,12 @@ BOOL torture_casetable(int dummy)
fflush(stdout);
}
- cli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
+ smbcli_close(cli->tree, fnum);
}
- cli_unlink(cli->tree, "\\utable\\*");
- cli_rmdir(cli->tree, "\\utable");
+ smbcli_unlink(cli->tree, "\\utable\\*");
+ smbcli_rmdir(cli->tree, "\\utable");
return True;
}
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index e45d9f0124..53dd83ac15 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -51,7 +51,7 @@ static uint_t num_open_handles;
/* state information for the servers. We open NINSTANCES connections to
each server */
static struct {
- struct cli_state *cli[NINSTANCES];
+ struct smbcli_state *cli[NINSTANCES];
char *server_name;
char *share_name;
char *username;
@@ -94,8 +94,8 @@ static struct {
#define BAD_HANDLE 0xFFFE
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
-static void idle_func(struct cli_transport *transport, void *private);
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
+static void idle_func(struct smbcli_transport *transport, void *private);
/*
check if a string should be ignored. This is used as the basis
@@ -127,7 +127,7 @@ static BOOL connect_servers_fast(void)
for (h=0;h<options.max_open_handles;h++) {
if (!open_handles[h].active) continue;
for (i=0;i<NSERVERS;i++) {
- if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree,
+ if (NT_STATUS_IS_ERR((smbcli_close(servers[i].cli[open_handles[h].instance]->tree,
open_handles[h].server_fnum[i])))) {
return False;
}
@@ -158,8 +158,8 @@ static BOOL connect_servers(void)
for (i=0;i<NSERVERS;i++) {
for (j=0;j<NINSTANCES;j++) {
if (servers[i].cli[j]) {
- cli_tdis(servers[i].cli[j]);
- cli_shutdown(servers[i].cli[j]);
+ smbcli_tdis(servers[i].cli[j]);
+ smbcli_shutdown(servers[i].cli[j]);
servers[i].cli[j] = NULL;
}
}
@@ -171,7 +171,7 @@ static BOOL connect_servers(void)
printf("Connecting to \\\\%s\\%s as %s - instance %d\n",
servers[i].server_name, servers[i].share_name,
servers[i].username, j);
- status = cli_full_connection(&servers[i].cli[j],
+ status = smbcli_full_connection(&servers[i].cli[j],
"gentest",
servers[i].server_name, NULL,
servers[i].share_name, "?????",
@@ -184,8 +184,8 @@ static BOOL connect_servers(void)
return False;
}
- cli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL);
- cli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL);
+ smbcli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL);
+ smbcli_transport_idle_handler(servers[i].cli[j]->transport, idle_func, 1, NULL);
}
}
@@ -234,10 +234,10 @@ static void gen_add_handle(int instance, const char *name, uint16_t fnums[NSERVE
/* we have to force close a random handle */
h = random() % options.max_open_handles;
for (i=0;i<NSERVERS;i++) {
- if (NT_STATUS_IS_ERR((cli_close(servers[i].cli[open_handles[h].instance]->tree,
+ if (NT_STATUS_IS_ERR((smbcli_close(servers[i].cli[open_handles[h].instance]->tree,
open_handles[h].server_fnum[i])))) {
printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n",
- cli_errstr(servers[i].cli[open_handles[h].instance]->tree));
+ smbcli_errstr(servers[i].cli[open_handles[h].instance]->tree));
}
}
printf("Recovered handle %d\n", h);
@@ -670,13 +670,13 @@ static struct ea_struct gen_ea_struct(void)
/*
this is called when a change notify reply comes in
*/
-static void async_notify(struct cli_request *req)
+static void async_notify(struct smbcli_request *req)
{
struct smb_notify notify;
NTSTATUS status;
int i, j;
uint16_t tid;
- struct cli_transport *transport = req->transport;
+ struct smbcli_transport *transport = req->transport;
tid = SVAL(req->in.hdr, HDR_TID);
@@ -704,13 +704,13 @@ static void async_notify(struct cli_request *req)
/*
the oplock handler will either ack the break or close the file
*/
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
union smb_close io;
NTSTATUS status;
int i, j;
BOOL do_close;
- struct cli_tree *tree = NULL;
+ struct smbcli_tree *tree = NULL;
srandom(current_op.seed);
do_close = gen_chance(50);
@@ -736,7 +736,7 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16
if (!do_close) {
printf("oplock ack fnum=%d\n", fnum);
- return cli_oplock_ack(tree, fnum, level);
+ return smbcli_oplock_ack(tree, fnum, level);
}
printf("oplock close fnum=%d\n", fnum);
@@ -758,14 +758,14 @@ static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16
an operation on another connection blocking until that break is acked
we check for operations on all transports in the idle function
*/
-static void idle_func(struct cli_transport *transport, void *private)
+static void idle_func(struct smbcli_transport *transport, void *private)
{
int i, j;
for (i=0;i<NSERVERS;i++) {
for (j=0;j<NINSTANCES;j++) {
if (servers[i].cli[j] &&
transport != servers[i].cli[j]->transport) {
- cli_transport_process(servers[i].cli[j]->transport);
+ smbcli_transport_process(servers[i].cli[j]->transport);
}
}
}
@@ -803,7 +803,7 @@ static void check_pending(void)
for (j=0;j<NINSTANCES;j++) {
for (i=0;i<NSERVERS;i++) {
- cli_transport_process(servers[i].cli[j]->transport);
+ smbcli_transport_process(servers[i].cli[j]->transport);
}
}
}
@@ -938,7 +938,7 @@ again:
ZERO_STRUCT(oplocks); \
ZERO_STRUCT(notifies); \
for (i=0;i<NSERVERS;i++) { \
- struct cli_tree *tree = servers[i].cli[instance]->tree; \
+ struct smbcli_tree *tree = servers[i].cli[instance]->tree; \
status[i] = call; \
} \
current_op.status = status[0]; \
@@ -1780,7 +1780,7 @@ static BOOL handler_notify(int instance)
GEN_SET_FNUM(in.fnum);
for (n=0;n<NSERVERS;n++) {
- struct cli_request *req;
+ struct smbcli_request *req;
req = smb_raw_changenotify_send(servers[n].cli[instance]->tree, &parm[n]);
req->async.fn = async_notify;
}
@@ -1795,14 +1795,14 @@ static void wipe_files(void)
{
int i;
for (i=0;i<NSERVERS;i++) {
- int n = cli_deltree(servers[i].cli[0]->tree, "\\gentest");
+ int n = smbcli_deltree(servers[i].cli[0]->tree, "\\gentest");
if (n == -1) {
printf("Failed to wipe tree on server %d\n", i);
exit(1);
}
- if (NT_STATUS_IS_ERR(cli_mkdir(servers[i].cli[0]->tree, "\\gentest"))) {
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(servers[i].cli[0]->tree, "\\gentest"))) {
printf("Failed to create \\gentest - %s\n",
- cli_errstr(servers[i].cli[0]->tree));
+ smbcli_errstr(servers[i].cli[0]->tree));
exit(1);
}
if (n > 0) {
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 383520260c..e56684a5a4 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -102,9 +102,9 @@ static struct record *recorded;
/*****************************************************
return a connection to a server
*******************************************************/
-static struct cli_state *connect_one(char *share, int snum)
+static struct smbcli_state *connect_one(char *share, int snum)
{
- struct cli_state *c;
+ struct smbcli_state *c;
fstring server, myname;
uint_t flags = 0;
NTSTATUS status;
@@ -119,10 +119,10 @@ static struct cli_state *connect_one(char *share, int snum)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum);
if (use_kerberos)
- flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
do {
- status = cli_full_connection(&c, myname,
+ status = smbcli_full_connection(&c, myname,
server, NULL,
share, "?????",
username[snum], lp_workgroup(),
@@ -140,7 +140,7 @@ static struct cli_state *connect_one(char *share, int snum)
}
-static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
+static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
char *share[NSERVERS])
{
int server, conn, f;
@@ -150,11 +150,11 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
if (cli[server][conn]) {
for (f=0;f<NFILES;f++) {
if (fnum[server][conn][f] != -1) {
- cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+ smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
fnum[server][conn][f] = -1;
}
}
- cli_shutdown(cli[server][conn]);
+ smbcli_shutdown(cli[server][conn]);
}
cli[server][conn] = connect_one(share[server], server);
if (!cli[server][conn]) {
@@ -166,7 +166,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
-static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NCONNECTIONS][NFILES],
struct record *rec)
{
@@ -183,10 +183,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
case OP_LOCK:
/* set a lock */
for (server=0;server<NSERVERS;server++) {
- ret[server] = NT_STATUS_IS_OK(cli_lock64(cli[server][conn]->tree,
+ ret[server] = NT_STATUS_IS_OK(smbcli_lock64(cli[server][conn]->tree,
fnum[server][conn][f],
start, len, LOCK_TIMEOUT, op));
- status[server] = cli_nt_error(cli[server][conn]->tree);
+ status[server] = smbcli_nt_error(cli[server][conn]->tree);
if (!exact_error_codes &&
NT_STATUS_EQUAL(status[server],
NT_STATUS_FILE_LOCK_CONFLICT)) {
@@ -206,10 +206,10 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
case OP_UNLOCK:
/* unset a lock */
for (server=0;server<NSERVERS;server++) {
- ret[server] = NT_STATUS_IS_OK(cli_unlock64(cli[server][conn]->tree,
+ ret[server] = NT_STATUS_IS_OK(smbcli_unlock64(cli[server][conn]->tree,
fnum[server][conn][f],
start, len));
- status[server] = cli_nt_error(cli[server][conn]->tree);
+ status[server] = smbcli_nt_error(cli[server][conn]->tree);
}
if (showall ||
(!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1]))) {
@@ -225,11 +225,11 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
case OP_REOPEN:
/* reopen the file */
for (server=0;server<NSERVERS;server++) {
- cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+ smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
fnum[server][conn][f] = -1;
}
for (server=0;server<NSERVERS;server++) {
- fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
+ fnum[server][conn][f] = smbcli_open(cli[server][conn]->tree, FILENAME,
O_RDWR|O_CREAT,
DENY_NONE);
if (fnum[server][conn][f] == -1) {
@@ -247,7 +247,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
return True;
}
-static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NCONNECTIONS][NFILES])
{
int server, conn, f;
@@ -256,16 +256,16 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
for (conn=0;conn<NCONNECTIONS;conn++)
for (f=0;f<NFILES;f++) {
if (fnum[server][conn][f] != -1) {
- cli_close(cli[server][conn]->tree, fnum[server][conn][f]);
+ smbcli_close(cli[server][conn]->tree, fnum[server][conn][f]);
fnum[server][conn][f] = -1;
}
}
for (server=0;server<NSERVERS;server++) {
- cli_unlink(cli[server][0]->tree, FILENAME);
+ smbcli_unlink(cli[server][0]->tree, FILENAME);
}
}
-static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static void open_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NCONNECTIONS][NFILES])
{
int server, conn, f;
@@ -273,7 +273,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
for (server=0;server<NSERVERS;server++)
for (conn=0;conn<NCONNECTIONS;conn++)
for (f=0;f<NFILES;f++) {
- fnum[server][conn][f] = cli_open(cli[server][conn]->tree, FILENAME,
+ fnum[server][conn][f] = smbcli_open(cli[server][conn]->tree, FILENAME,
O_RDWR|O_CREAT,
DENY_NONE);
if (fnum[server][conn][f] == -1) {
@@ -285,7 +285,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
}
-static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NCONNECTIONS][NFILES],
int n)
{
@@ -311,7 +311,7 @@ static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
*/
static void test_locks(char *share[NSERVERS])
{
- struct cli_state *cli[NSERVERS][NCONNECTIONS];
+ struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
int fnum[NSERVERS][NCONNECTIONS][NFILES];
int n, i, n1, skip, r1, r2;
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index 40227d2997..63f71f2004 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -60,13 +60,13 @@ struct record {
static struct record *recorded;
-static int try_open(struct cli_state *c, char *nfs, int fstype, const char *fname, int flags)
+static int try_open(struct smbcli_state *c, char *nfs, int fstype, const char *fname, int flags)
{
pstring path;
switch (fstype) {
case FSTYPE_SMB:
- return cli_open(c, fname, flags, DENY_NONE);
+ return smbcli_open(c, fname, flags, DENY_NONE);
case FSTYPE_NFS:
slprintf(path, sizeof(path), "%s%s", nfs, fname);
@@ -77,11 +77,11 @@ static int try_open(struct cli_state *c, char *nfs, int fstype, const char *fnam
return -1;
}
-static BOOL try_close(struct cli_state *c, int fstype, int fd)
+static BOOL try_close(struct smbcli_state *c, int fstype, int fd)
{
switch (fstype) {
case FSTYPE_SMB:
- return cli_close(c, fd);
+ return smbcli_close(c, fd);
case FSTYPE_NFS:
return close(fd) == 0;
@@ -90,7 +90,7 @@ static BOOL try_close(struct cli_state *c, int fstype, int fd)
return False;
}
-static BOOL try_lock(struct cli_state *c, int fstype,
+static BOOL try_lock(struct smbcli_state *c, int fstype,
int fd, uint_t start, uint_t len,
enum brl_type op)
{
@@ -98,7 +98,7 @@ static BOOL try_lock(struct cli_state *c, int fstype,
switch (fstype) {
case FSTYPE_SMB:
- return cli_lock(c, fd, start, len, LOCK_TIMEOUT, op);
+ return smbcli_lock(c, fd, start, len, LOCK_TIMEOUT, op);
case FSTYPE_NFS:
lock.l_type = (op==READ_LOCK) ? F_RDLCK:F_WRLCK;
@@ -112,14 +112,14 @@ static BOOL try_lock(struct cli_state *c, int fstype,
return False;
}
-static BOOL try_unlock(struct cli_state *c, int fstype,
+static BOOL try_unlock(struct smbcli_state *c, int fstype,
int fd, uint_t start, uint_t len)
{
struct flock lock;
switch (fstype) {
case FSTYPE_SMB:
- return cli_unlock(c, fd, start, len);
+ return smbcli_unlock(c, fd, start, len);
case FSTYPE_NFS:
lock.l_type = F_UNLCK;
@@ -147,9 +147,9 @@ static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid,
/*****************************************************
return a connection to a server
*******************************************************/
-static struct cli_state *connect_one(char *share)
+static struct smbcli_state *connect_one(char *share)
{
- struct cli_state *c;
+ struct smbcli_state *c;
char *server_n;
fstring server;
fstring myname;
@@ -173,12 +173,12 @@ static struct cli_state *connect_one(char *share)
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
- nt_status = cli_full_connection(&c, myname, server_n, NULL, 0, share, "?????",
+ nt_status = smbcli_full_connection(&c, myname, server_n, NULL, 0, share, "?????",
username, lp_workgroup(), password, 0,
NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
- DEBUG(0, ("cli_full_connection failed with error %s\n", nt_errstr(nt_status)));
+ DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;
}
@@ -188,7 +188,7 @@ static struct cli_state *connect_one(char *share)
}
-static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
char *share1, char *share2)
@@ -204,10 +204,10 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS],
for (conn=0;conn<NCONNECTIONS;conn++) {
if (cli[server][conn]) {
for (f=0;f<NFILES;f++) {
- cli_close(cli[server][conn], fnum[server][fstype][conn][f]);
+ smbcli_close(cli[server][conn], fnum[server][fstype][conn][f]);
}
- cli_ulogoff(cli[server][conn]);
- cli_shutdown(cli[server][conn]);
+ smbcli_ulogoff(cli[server][conn]);
+ smbcli_shutdown(cli[server][conn]);
}
cli[server][conn] = connect_one(share[server]);
if (!cli[server][conn]) {
@@ -219,7 +219,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS],
-static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
struct record *rec)
@@ -292,7 +292,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
return True;
}
-static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES])
{
@@ -308,11 +308,11 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
}
}
for (server=0;server<NSERVERS;server++) {
- cli_unlink(cli[server][0], FILENAME);
+ smbcli_unlink(cli[server][0], FILENAME);
}
}
-static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static void open_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES])
{
@@ -333,7 +333,7 @@ static void open_files(struct cli_state *cli[NSERVERS][NCONNECTIONS],
}
-static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
+static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
int n)
@@ -360,7 +360,7 @@ static int retest(struct cli_state *cli[NSERVERS][NCONNECTIONS],
*/
static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2)
{
- struct cli_state *cli[NSERVERS][NCONNECTIONS];
+ struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
char *nfs[NSERVERS];
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES];
int n, i, n1;
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 6a511d8b49..4c219c630e 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -123,7 +123,7 @@ static int ms_fnmatch_lanman(const char *pattern, const char *string)
return ms_fnmatch_lanman_core(pattern, string);
}
-static BOOL reg_match_one(struct cli_state *cli, const char *pattern, const char *file)
+static BOOL reg_match_one(struct smbcli_state *cli, const char *pattern, const char *file)
{
/* oh what a weird world this is */
if (old_list && strcmp(pattern, "*.*") == 0) return True;
@@ -139,7 +139,7 @@ static BOOL reg_match_one(struct cli_state *cli, const char *pattern, const char
return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0;
}
-static char *reg_test(struct cli_state *cli, char *pattern, char *long_name, char *short_name)
+static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name, char *short_name)
{
static fstring ret;
fstrcpy(ret, "---");
@@ -157,9 +157,9 @@ static char *reg_test(struct cli_state *cli, char *pattern, char *long_name, cha
/*****************************************************
return a connection to a server
*******************************************************/
-static struct cli_state *connect_one(char *share)
+static struct smbcli_state *connect_one(char *share)
{
- struct cli_state *c;
+ struct smbcli_state *c;
fstring server;
uint_t flags = 0;
NTSTATUS status;
@@ -170,7 +170,7 @@ static struct cli_state *connect_one(char *share)
*share = 0;
share++;
- status = cli_full_connection(&c, "masktest",
+ status = smbcli_full_connection(&c, "masktest",
server, NULL,
share, "?????",
username, lp_workgroup(),
@@ -204,7 +204,7 @@ static void listfn(file_info *f, const char *s, void *state)
f_info_hit = True;
}
-static void get_real_name(struct cli_state *cli,
+static void get_real_name(struct smbcli_state *cli,
pstring long_name, fstring short_name)
{
const char *mask;
@@ -216,7 +216,7 @@ static void get_real_name(struct cli_state *cli,
f_info_hit = False;
- cli_list_new(cli->tree, mask,
+ smbcli_list_new(cli->tree, mask,
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
listfn, NULL);
@@ -232,7 +232,7 @@ static void get_real_name(struct cli_state *cli,
}
}
-static void testpair(struct cli_state *cli, char *mask, char *file)
+static void testpair(struct smbcli_state *cli, char *mask, char *file)
{
int fnum;
fstring res1;
@@ -245,18 +245,18 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
fstrcpy(res1, "---");
- fnum = cli_open(cli->tree, file, O_CREAT|O_TRUNC|O_RDWR, 0);
+ fnum = smbcli_open(cli->tree, file, O_CREAT|O_TRUNC|O_RDWR, 0);
if (fnum == -1) {
DEBUG(0,("Can't create %s\n", file));
return;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
resultp = res1;
fstrcpy(short_name, "");
get_real_name(cli, long_name, short_name);
fstrcpy(res1, "---");
- cli_list(cli->tree, mask,
+ smbcli_list(cli->tree, mask,
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
listfn, NULL);
@@ -268,22 +268,22 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
if (die_on_error) exit(1);
}
- cli_unlink(cli->tree, file);
+ smbcli_unlink(cli->tree, file);
if (count % 100 == 0) DEBUG(0,("%d\n", count));
}
static void test_mask(int argc, char *argv[],
- struct cli_state *cli)
+ struct smbcli_state *cli)
{
pstring mask, file;
int l1, l2, i, l;
int mc_len = strlen(maskchars);
int fc_len = strlen(filechars);
- cli_mkdir(cli->tree, "\\masktest");
+ smbcli_mkdir(cli->tree, "\\masktest");
- cli_unlink(cli->tree, "\\masktest\\*");
+ smbcli_unlink(cli->tree, "\\masktest\\*");
if (argc >= 2) {
while (argc >= 2) {
@@ -326,7 +326,7 @@ static void test_mask(int argc, char *argv[],
}
finished:
- cli_rmdir(cli->tree, "\\masktest");
+ smbcli_rmdir(cli->tree, "\\masktest");
}
@@ -361,7 +361,7 @@ static void usage(void)
int main(int argc,char *argv[])
{
char *share;
- struct cli_state *cli;
+ struct smbcli_state *cli;
int opt;
char *p;
int seed;
diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c
index 30291a829e..316e87ce99 100644
--- a/source4/torture/nbench/nbench.c
+++ b/source4/torture/nbench/nbench.c
@@ -28,7 +28,7 @@ static const char *loadfile;
#define ival(s) strtol(s, NULL, 0)
/* run a test that simulates an approximate netbench client load */
-static BOOL run_netbench(struct cli_state *cli, int client)
+static BOOL run_netbench(struct smbcli_state *cli, int client)
{
int i;
pstring line;
@@ -164,7 +164,7 @@ BOOL torture_nbench(int dummy)
{
BOOL correct = True;
extern int torture_nprocs;
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *p;
p = lp_parm_string(-1, "torture", "timelimit");
diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c
index a7a82027a3..9b6ec7943d 100644
--- a/source4/torture/nbench/nbio.c
+++ b/source4/torture/nbench/nbio.c
@@ -138,18 +138,18 @@ static int find_handle(int handle)
-static struct cli_state *c;
+static struct smbcli_state *c;
/*
a handler function for oplock break requests
*/
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
- struct cli_tree *tree = private;
- return cli_oplock_ack(tree, fnum, level);
+ struct smbcli_tree *tree = private;
+ return smbcli_oplock_ack(tree, fnum, level);
}
-void nb_setup(struct cli_state *cli, int id, int warmupt)
+void nb_setup(struct smbcli_state *cli, int id, int warmupt)
{
warmup = warmupt;
nbio_id = id;
@@ -162,7 +162,7 @@ void nb_setup(struct cli_state *cli, int id, int warmupt)
printf("skipping I/O\n");
if (cli) {
- cli_oplock_handler(cli->transport, oplock_handler, cli->tree);
+ smbcli_oplock_handler(cli->transport, oplock_handler, cli->tree);
}
}
@@ -560,7 +560,7 @@ void nb_qfsinfo(int level, NTSTATUS status)
TALLOC_CTX *mem_ctx;
NTSTATUS ret;
- mem_ctx = talloc_init("cli_dskattr");
+ mem_ctx = talloc_init("smbcli_dskattr");
io.generic.level = level;
ret = smb_raw_fsinfo(c->tree, mem_ctx, &io);
@@ -582,7 +582,7 @@ void nb_findfirst(const char *mask, int level, int maxcnt, int count, NTSTATUS s
TALLOC_CTX *mem_ctx;
NTSTATUS ret;
- mem_ctx = talloc_init("cli_dskattr");
+ mem_ctx = talloc_init("smbcli_dskattr");
io.t2ffirst.level = level;
io.t2ffirst.in.max_count = maxcnt;
@@ -630,14 +630,14 @@ void nb_deltree(const char *dname)
free(f);
}
- total_deleted = cli_deltree(c->tree, dname);
+ total_deleted = smbcli_deltree(c->tree, dname);
if (total_deleted == -1) {
printf("Failed to cleanup tree %s - exiting\n", dname);
exit(1);
}
- cli_rmdir(c->tree, dname);
+ smbcli_rmdir(c->tree, dname);
}
void nb_cleanup(const char *cname)
@@ -646,6 +646,6 @@ void nb_cleanup(const char *cname)
asprintf(&dname, "\\clients\\%s", cname);
nb_deltree(dname);
free(dname);
- cli_rmdir(c->tree, "clients");
+ smbcli_rmdir(c->tree, "clients");
children[nbio_id].done = 1;
}
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index 2ed069fd61..0a5ef6d34e 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -155,7 +155,7 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
return NT_STATUS_OK;
}
-static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static NTSTATUS rap_cli_do_call(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
struct rap_call *call)
{
NTSTATUS result;
@@ -212,7 +212,7 @@ static NTSTATUS rap_cli_do_call(struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done; \
} while (0)
-static NTSTATUS cli_rap_netshareenum(struct cli_state *cli,
+static NTSTATUS smbcli_rap_netshareenum(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
struct rap_NetShareEnum *r)
{
@@ -282,7 +282,7 @@ static NTSTATUS cli_rap_netshareenum(struct cli_state *cli,
return result;
}
-static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_netshareenum(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
struct rap_NetShareEnum r;
int i;
@@ -290,7 +290,7 @@ static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
r.in.level = 1;
r.in.bufsize = 8192;
- if (!NT_STATUS_IS_OK(cli_rap_netshareenum(cli, mem_ctx, &r)))
+ if (!NT_STATUS_IS_OK(smbcli_rap_netshareenum(cli, mem_ctx, &r)))
return False;
for (i=0; i<r.out.count; i++) {
@@ -302,7 +302,7 @@ static BOOL test_netshareenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
return True;
}
-static NTSTATUS cli_rap_netserverenum2(struct cli_state *cli,
+static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
struct rap_NetServerEnum2 *r)
{
@@ -377,7 +377,7 @@ static NTSTATUS cli_rap_netserverenum2(struct cli_state *cli,
return result;
}
-static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_netserverenum(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
struct rap_NetServerEnum2 r;
int i;
@@ -388,7 +388,7 @@ static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
r.in.servertype = 0x80000000;
r.in.domain = NULL;
- if (!NT_STATUS_IS_OK(cli_rap_netserverenum2(cli, mem_ctx, &r)))
+ if (!NT_STATUS_IS_OK(smbcli_rap_netserverenum2(cli, mem_ctx, &r)))
return False;
for (i=0; i<r.out.count; i++) {
@@ -409,7 +409,7 @@ static BOOL test_netserverenum(struct cli_state *cli, TALLOC_CTX *mem_ctx)
-static BOOL test_rap(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_rap(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
BOOL res = True;
@@ -424,7 +424,7 @@ static BOOL test_rap(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL torture_raw_rap(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c
index 4b063bfa48..b5f03dd3a1 100644
--- a/source4/torture/raw/chkpath.c
+++ b/source4/torture/raw/chkpath.c
@@ -31,7 +31,7 @@
}} while (0)
-static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
struct smb_chkpath io;
NTSTATUS status;
@@ -49,7 +49,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\test.txt");
if (fnum == -1) {
- printf("failed to open test.txt - %s\n", cli_errstr(cli->tree));
+ printf("failed to open test.txt - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -126,7 +126,7 @@ static BOOL test_chkpath(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
return ret;
}
@@ -135,7 +135,7 @@ done:
*/
BOOL torture_raw_chkpath(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
int fnum;
TALLOC_CTX *mem_ctx;
@@ -146,33 +146,33 @@ BOOL torture_raw_chkpath(int dummy)
mem_ctx = talloc_init("torture_raw_chkpath");
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt"))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt"))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio"))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio"))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio\\VB98"))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\Visual Studio\\VB98"))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\nt\\Visual Studio\\VB98\\vb6.exe");
if (fnum == -1) {
- printf("failed to open \\nt\\Visual Studio\\VB98\\vb6.exe - %s\n", cli_errstr(cli->tree));
+ printf("failed to open \\nt\\Visual Studio\\VB98\\vb6.exe - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -184,7 +184,7 @@ BOOL torture_raw_chkpath(int dummy)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c
index e2221946a0..1007226ded 100644
--- a/source4/torture/raw/close.c
+++ b/source4/torture/raw/close.c
@@ -25,7 +25,7 @@
*/
BOOL torture_raw_close(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
union smb_close io;
@@ -100,7 +100,7 @@ BOOL torture_raw_close(int dummy)
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
REOPEN;
finfo2.generic.in.fname = fname;
@@ -137,7 +137,7 @@ BOOL torture_raw_close(int dummy)
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
printf("testing flush\n");
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
io_flush.in.fnum = fnum;
status = smb_raw_flush(cli->tree, &io_flush);
@@ -162,8 +162,8 @@ BOOL torture_raw_close(int dummy)
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index 29aa915b5d..763edffeb2 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -42,13 +42,13 @@
/*
test session ops
*/
-static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
BOOL ret = True;
char *username, *domain, *password;
- struct cli_session *session;
- struct cli_tree *tree;
+ struct smbcli_session *session;
+ struct smbcli_tree *tree;
union smb_sesssetup setup;
union smb_open io;
union smb_write wr;
@@ -59,9 +59,9 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING SESSION HANDLING\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -70,7 +70,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
domain = lp_workgroup();
printf("create a second security context on the same transport\n");
- session = cli_session_init(cli->transport);
+ session = smbcli_session_init(cli->transport);
setup.generic.level = RAW_SESSSETUP_GENERIC;
setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
setup.generic.in.capabilities = 0; /* ignored in secondary session setup */
@@ -84,7 +84,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
session->vuid = setup.generic.out.vuid;
printf("use the same tree as the existing connection\n");
- tree = cli_tree_init(session);
+ tree = smbcli_tree_init(session);
tree->tid = cli->tree->tid;
cli->tree->reference_count++;
@@ -141,7 +141,7 @@ static BOOL test_session(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/* close down the new tree, which will also close the session
as the reference count will be 0 */
- cli_tree_close(tree);
+ smbcli_tree_close(tree);
done:
return ret;
@@ -151,12 +151,12 @@ done:
/*
test tree ops
*/
-static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
BOOL ret = True;
char *share;
- struct cli_tree *tree;
+ struct smbcli_tree *tree;
union smb_tcon tcon;
union smb_open io;
union smb_write wr;
@@ -167,16 +167,16 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING TREE HANDLING\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
share = lp_parm_string(-1, "torture", "share");
printf("create a second tree context on the same session\n");
- tree = cli_tree_init(cli->session);
+ tree = smbcli_tree_init(cli->session);
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
@@ -245,7 +245,7 @@ static BOOL test_tree(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
/* close down the new tree */
- cli_tree_close(tree);
+ smbcli_tree_close(tree);
done:
return ret;
@@ -255,7 +255,7 @@ done:
/*
test pid ops
*/
-static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_pid(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
BOOL ret = True;
@@ -269,9 +269,9 @@ static BOOL test_pid(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING PID HANDLING\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -357,7 +357,7 @@ done:
*/
BOOL torture_raw_context(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -380,7 +380,7 @@ BOOL torture_raw_context(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c
index 4fd296d811..f7ce954c94 100644
--- a/source4/torture/raw/ioctl.c
+++ b/source4/torture/raw/ioctl.c
@@ -33,7 +33,7 @@
/* test some ioctls */
-static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_ioctl ctl;
int fnum;
@@ -45,7 +45,7 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
+ printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -64,12 +64,12 @@ static BOOL test_ioctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
return ret;
}
/* test some filesystem control functions */
-static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
int fnum;
NTSTATUS status;
@@ -81,7 +81,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("Failed to create test.dat - %s\n", cli_errstr(cli->tree));
+ printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -114,7 +114,7 @@ static BOOL test_fsctl(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#endif
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
return ret;
}
@@ -123,7 +123,7 @@ done:
*/
BOOL torture_raw_ioctl(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -133,12 +133,12 @@ BOOL torture_raw_ioctl(int dummy)
mem_ctx = talloc_init("torture_raw_ioctl");
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
@@ -151,7 +151,7 @@ BOOL torture_raw_ioctl(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index 9a9b841568..a076f62152 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -42,7 +42,7 @@
/*
test SMBlock and SMBunlock ops
*/
-static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_lock io;
NTSTATUS status;
@@ -50,18 +50,18 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
int fnum;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_LOCK_LOCK\n");
io.generic.level = RAW_LOCK_LOCK;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -133,9 +133,9 @@ static BOOL test_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -143,7 +143,7 @@ done:
/*
test locking&X ops
*/
-static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lockx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_lock io;
struct smb_lock_entry lock[1];
@@ -152,18 +152,18 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
int fnum;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_LOCK_LOCKX\n");
io.generic.level = RAW_LOCK_LOCKX;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -182,9 +182,9 @@ static BOOL test_lockx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -192,7 +192,7 @@ done:
/*
test high pid
*/
-static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_pidhigh(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_lock io;
struct smb_lock_entry lock[1];
@@ -202,9 +202,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
const char *fname = BASEDIR "\\test.txt";
char c = 1;
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -213,15 +213,15 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 1;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
- if (cli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
- printf("Failed to write 1 byte - %s\n", cli_errstr(cli->tree));
+ if (smbcli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
+ printf("Failed to write 1 byte - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -239,8 +239,8 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
- printf("Failed to read 1 byte - %s\n", cli_errstr(cli->tree));
+ if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
+ printf("Failed to read 1 byte - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -249,7 +249,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 2;
- if (cli_read(cli->tree, fnum, &c, 0, 1) == 1) {
+ if (smbcli_read(cli->tree, fnum, &c, 0, 1) == 1) {
printf("pid is incorrect handled for read with lock!\n");
ret = False;
goto done;
@@ -257,7 +257,7 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 0x10001;
- if (cli_read(cli->tree, fnum, &c, 0, 1) != 1) {
+ if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
printf("High pid is used on this server!\n");
ret = False;
} else {
@@ -265,9 +265,9 @@ static BOOL test_pidhigh(struct cli_state *cli, TALLOC_CTX *mem_ctx)
}
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -277,7 +277,7 @@ done:
*/
BOOL torture_raw_lock(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c
index b614800106..bc2ddbb544 100644
--- a/source4/torture/raw/mkdir.c
+++ b/source4/torture/raw/mkdir.c
@@ -31,7 +31,7 @@
/*
test mkdir ops
*/
-static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_mkdir md;
struct smb_rmdir rd;
@@ -40,8 +40,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
BOOL ret = True;
/* cleanup */
- cli_rmdir(cli->tree, path);
- cli_unlink(cli->tree, path);
+ smbcli_rmdir(cli->tree, path);
+ smbcli_unlink(cli->tree, path);
/*
basic mkdir
@@ -69,7 +69,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing mkdir collision with file\n");
/* name collision with a file */
- cli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
+ smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path));
status = smb_raw_mkdir(cli->tree, &md);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
@@ -79,7 +79,7 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_rmdir(cli->tree, &rd);
CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
- cli_unlink(cli->tree, path);
+ smbcli_unlink(cli->tree, path);
printf("testing invalid dir\n");
@@ -110,8 +110,8 @@ static BOOL test_mkdir(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_rmdir(cli->tree, path);
- cli_unlink(cli->tree, path);
+ smbcli_rmdir(cli->tree, path);
+ smbcli_unlink(cli->tree, path);
return ret;
}
@@ -121,7 +121,7 @@ done:
*/
BOOL torture_raw_mkdir(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c
index 8b3bcc12e3..1554206455 100644
--- a/source4/torture/raw/mux.c
+++ b/source4/torture/raw/mux.c
@@ -34,13 +34,13 @@
/*
test the delayed reply to a open that leads to a sharing violation
*/
-static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
NTSTATUS status;
int fnum;
BOOL ret = True;
- struct cli_request *req;
+ struct smbcli_request *req;
printf("testing multiplexed open/open/close\n");
@@ -74,13 +74,13 @@ static BOOL test_mux_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
req = smb_raw_open_send(cli->tree, &io);
/* and close the file */
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
/* see if the async open succeeded */
status = smb_raw_open_recv(req, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.ntcreatex.out.fnum);
+ smbcli_close(cli->tree, io.ntcreatex.out.fnum);
done:
return ret;
@@ -90,19 +90,19 @@ done:
/*
test a write that hits a byte range lock and send the close after the write
*/
-static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_write io;
NTSTATUS status;
int fnum;
BOOL ret = True;
- struct cli_request *req;
+ struct smbcli_request *req;
printf("testing multiplexed lock/write/close\n");
- fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
+ printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -110,8 +110,8 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
cli->session->pid = 1;
/* lock a range */
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) {
- printf("lock failed in mux_write - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) {
+ printf("lock failed in mux_write - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -130,13 +130,13 @@ static BOOL test_mux_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/* unlock the range */
cli->session->pid = 1;
- cli_unlock(cli->tree, fnum, 0, 4);
+ smbcli_unlock(cli->tree, fnum, 0, 4);
/* and recv the async write reply */
status = smb_raw_write_recv(req, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
done:
return ret;
@@ -146,20 +146,20 @@ done:
/*
test a lock that conflicts with an existing lock
*/
-static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_lock io;
NTSTATUS status;
int fnum;
BOOL ret = True;
- struct cli_request *req;
+ struct smbcli_request *req;
struct smb_lock_entry lock[1];
printf("TESTING MULTIPLEXED LOCK/LOCK/UNLOCK\n");
- fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("open failed in mux_write - %s\n", cli_errstr(cli->tree));
+ printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -197,12 +197,12 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("recv the async reply\n");
- status = cli_request_simple_recv(req);
+ status = smbcli_request_simple_recv(req);
CHECK_STATUS(status, NT_STATUS_OK);
printf("reopening with an exit\n");
smb_raw_exit(cli->session);
- fnum = cli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE);
printf("Now trying with a cancel\n");
@@ -237,10 +237,10 @@ static BOOL test_mux_lock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_lock(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- status = cli_request_simple_recv(req);
+ status = smbcli_request_simple_recv(req);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
done:
return ret;
@@ -253,7 +253,7 @@ done:
*/
BOOL torture_raw_mux(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -264,14 +264,14 @@ BOOL torture_raw_mux(int dummy)
mem_ctx = talloc_init("torture_raw_mux");
/* cleanup */
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to cleanup " BASEDIR "\n");
ret = False;
goto done;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
printf("Failed to create %s\n", BASEDIR);
ret = False;
goto done;
@@ -291,7 +291,7 @@ BOOL torture_raw_mux(int dummy)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index b94474aa43..6e7cf218ea 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -52,14 +52,14 @@
*/
BOOL torture_raw_notify(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
struct smb_notify notify;
union smb_open io;
int fnum = -1;
- struct cli_request *req;
+ struct smbcli_request *req;
if (!torture_open_connection(&cli)) {
return False;
@@ -68,7 +68,7 @@ BOOL torture_raw_notify(int dummy)
mem_ctx = talloc_init("torture_raw_notify");
/* cleanup */
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to cleanup " BASEDIR "\n");
ret = False;
goto done;
@@ -103,7 +103,7 @@ BOOL torture_raw_notify(int dummy)
printf("testing notify mkdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -115,7 +115,7 @@ BOOL torture_raw_notify(int dummy)
printf("testing notify rmdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- cli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -127,13 +127,13 @@ BOOL torture_raw_notify(int dummy)
req = smb_raw_changenotify_send(cli->tree, &notify);
smb_raw_ntcancel(req);
- cli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_CANCELLED);
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
return ret;
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 8a4e09374b..8cdc18fe2f 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -28,11 +28,11 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
/*
check if a open file can be read/written
*/
-static enum rdwr_mode check_rdwr(struct cli_tree *tree, int fnum)
+static enum rdwr_mode check_rdwr(struct smbcli_tree *tree, int fnum)
{
char c = 1;
- BOOL can_read = (cli_read(tree, fnum, &c, 0, 1) == 1);
- BOOL can_write = (cli_write(tree, fnum, 0, &c, 0, 1) == 1);
+ BOOL can_read = (smbcli_read(tree, fnum, &c, 0, 1) == 1);
+ BOOL can_write = (smbcli_write(tree, fnum, 0, &c, 0, 1) == 1);
if ( can_read && can_write) return RDWR_RDWR;
if ( can_read && !can_write) return RDWR_RDONLY;
if (!can_read && can_write) return RDWR_WRONLY;
@@ -64,7 +64,7 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CREATE_FILE do { \
fnum = create_complex_file(cli, mem_ctx, fname); \
if (fnum == -1) { \
- printf("(%d) Failed to create %s - %s\n", __LINE__, fname, cli_errstr(cli->tree)); \
+ printf("(%d) Failed to create %s - %s\n", __LINE__, fname, smbcli_errstr(cli->tree)); \
ret = False; \
goto done; \
}} while (0)
@@ -144,7 +144,7 @@ static const char *rdwr_string(enum rdwr_mode m)
/*
test RAW_OPEN_OPEN
*/
-static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -163,9 +163,9 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
fnum = io.open.out.fnum;
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
CREATE_FILE;
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -176,8 +176,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.open.out.fnum;
CHECK_RDWR(fnum2, RDWR_RDWR);
- cli_close(cli->tree, fnum2);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
+ smbcli_close(cli->tree, fnum);
/* check the read/write modes */
io.open.level = RAW_OPEN_OPEN;
@@ -189,21 +189,21 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_RDONLY);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
io.open.in.flags = OPEN_FLAGS_OPEN_WRITE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_WRONLY);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.open.out.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
/* check the share modes roughly - not a complete matrix */
io.open.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
@@ -226,8 +226,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.open.out.fnum;
CHECK_RDWR(fnum2, RDWR_RDONLY);
- cli_close(cli->tree, fnum);
- cli_close(cli->tree, fnum2);
+ smbcli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
/* check the returned write time */
@@ -245,8 +245,8 @@ static BOOL test_open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.open.out.attrib, attrib);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -255,7 +255,7 @@ done:
/*
test RAW_OPEN_OPENX
*/
-static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -284,7 +284,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
};
printf("Checking RAW_OPEN_OPENX\n");
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
io.openx.level = RAW_OPEN_OPENX;
io.openx.in.fname = fname;
@@ -301,11 +301,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
if (open_funcs[i].with_file) {
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+ d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
}
io.openx.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -316,8 +316,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli->tree, io.openx.out.fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.openx.out.fnum);
+ smbcli_unlink(cli->tree, fname);
}
}
@@ -336,8 +336,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.openx.out.ftype, 0);
CHECK_VAL(io.openx.out.devstate, 0);
CHECK_VAL(io.openx.out.action, OPENX_ACTION_CREATED);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* check the fields when the file already existed */
fnum2 = create_complex_file(cli, mem_ctx, fname);
@@ -345,7 +345,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
goto done;
}
- cli_close(cli->tree, fnum2);
+ smbcli_close(cli->tree, fnum2);
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -357,7 +357,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.openx.out.action, OPENX_ACTION_EXISTED);
CHECK_VAL(io.openx.out.unknown, 0);
CHECK_ALL_INFO(io.openx.out.attrib, attrib);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -366,15 +366,15 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.search_attrs = FILE_ATTRIBUTE_HIDDEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.openx.out.fnum);
+ smbcli_close(cli->tree, io.openx.out.fnum);
io.openx.in.search_attrs = 0;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.openx.out.fnum);
+ smbcli_close(cli->tree, io.openx.out.fnum);
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
/* and check attrib on create */
io.openx.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -383,8 +383,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, attrib);
- cli_close(cli->tree, io.openx.out.fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.openx.out.fnum);
+ smbcli_unlink(cli->tree, fname);
/* check timeout on create - win2003 ignores the timeout! */
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
@@ -404,8 +404,8 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
__LINE__, (int)end_timer());
ret = False;
}
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* now this is a really weird one - open for execute implies create?! */
io.openx.in.fname = fname;
@@ -419,7 +419,7 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.timeout = 0;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.openx.out.fnum);
+ smbcli_close(cli->tree, io.openx.out.fnum);
/* check the extended return flag */
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO | OPENX_FLAGS_EXTENDED_RETURN;
@@ -427,11 +427,11 @@ static BOOL test_openx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(io.openx.out.access_mask, STD_RIGHT_ALL_ACCESS);
- cli_close(cli->tree, io.openx.out.fnum);
+ smbcli_close(cli->tree, io.openx.out.fnum);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -444,7 +444,7 @@ done:
is why you see all the ACCESS_DENIED results below. When we finally work this out then this
test will make more sense
*/
-static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -496,11 +496,11 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
if (open_funcs[i].with_file) {
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+ d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
}
io.t2open.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -511,14 +511,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli->tree, io.t2open.out.fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.t2open.out.fnum);
+ smbcli_unlink(cli->tree, fname);
}
}
/* check the basic return fields */
fnum = create_complex_file(cli, mem_ctx, fname);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -531,7 +531,7 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.t2open.out.ftype, 0);
CHECK_VAL(io.t2open.out.devstate, 0);
CHECK_VAL(io.t2open.out.action, OPENX_ACTION_EXISTED);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
@@ -539,14 +539,14 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.t2open.out.fnum);
+ smbcli_close(cli->tree, io.t2open.out.fnum);
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.t2open.out.fnum);
+ smbcli_close(cli->tree, io.t2open.out.fnum);
SET_ATTRIB(FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
/* and check attrib on create */
io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
@@ -562,8 +562,8 @@ static BOOL test_t2open(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -572,7 +572,7 @@ done:
/*
test RAW_OPEN_NTCREATEX
*/
-static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
union smb_fileinfo finfo;
@@ -622,13 +622,13 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
/* test the open disposition */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
if (open_funcs[i].with_file) {
- fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, cli_errstr(cli->tree));
+ d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
}
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -639,8 +639,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
ret = False;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
- cli_close(cli->tree, io.ntcreatex.out.fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.ntcreatex.out.fnum);
+ smbcli_unlink(cli->tree, fname);
}
}
@@ -664,14 +664,14 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
/* check fields when the file already existed */
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
ret = False;
goto done;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -689,8 +689,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.ntcreatex.out.size, size);
CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* create a directory */
@@ -704,8 +704,8 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.ntcreatex.in.fname = dname;
fname = dname;
- cli_rmdir(cli->tree, fname);
- cli_unlink(cli->tree, fname);
+ smbcli_rmdir(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
io.ntcreatex.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -730,12 +730,12 @@ static BOOL test_ntcreatex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.ntcreatex.out.size, 0);
CHECK_VAL(io.ntcreatex.out.alloc_size, 0);
CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -748,7 +748,7 @@ done:
open_disposition==NTCREATEX_DISP_OVERWRITE_IF. Windows 2003 allows the
second open.
*/
-static BOOL test_ntcreatex_brlocked(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io, io1;
union smb_lock io2;
@@ -808,16 +808,16 @@ static BOOL test_ntcreatex_brlocked(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli->tree, io.ntcreatex.out.fnum);
- cli_close(cli->tree, io1.ntcreatex.out.fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.ntcreatex.out.fnum);
+ smbcli_close(cli->tree, io1.ntcreatex.out.fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
/*
test RAW_OPEN_MKNEW
*/
-static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_mknew.txt";
@@ -840,8 +840,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* make sure write_time works */
io.mknew.in.write_time = basetime;
@@ -850,8 +850,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = io.mknew.out.fnum;
CHECK_TIME(basetime, write_time);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* make sure file_attrs works */
io.mknew.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -861,8 +861,8 @@ static BOOL test_mknew(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -871,7 +871,7 @@ done:
/*
test RAW_OPEN_CREATE
*/
-static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
const char *fname = BASEDIR "\\torture_create.txt";
@@ -894,9 +894,9 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- cli_close(cli->tree, io.create.out.fnum);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, io.create.out.fnum);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* make sure write_time works */
io.create.in.write_time = basetime;
@@ -905,8 +905,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = io.create.out.fnum;
CHECK_TIME(basetime, write_time);
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
/* make sure file_attrs works */
io.create.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -916,8 +916,8 @@ static BOOL test_create(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, attrib);
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -926,7 +926,7 @@ done:
/*
test RAW_OPEN_CTEMP
*/
-static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_open io;
NTSTATUS status;
@@ -959,9 +959,9 @@ static BOOL test_ctemp(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_TIME(basetime, write_time);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
if (fname) {
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
}
return ret;
@@ -971,7 +971,7 @@ done:
*/
BOOL torture_raw_open(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
@@ -981,12 +981,12 @@ BOOL torture_raw_open(int dummy)
mem_ctx = talloc_init("torture_raw_open");
- if (cli_deltree(cli->tree, BASEDIR) == -1) {
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1) {
printf("Failed to clean " BASEDIR "\n");
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
@@ -1023,7 +1023,7 @@ BOOL torture_raw_open(int dummy)
}
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 6d6953354b..4b531a6950 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -45,26 +45,26 @@ static struct {
/*
a handler function for oplock break requests
*/
-static BOOL oplock_handler_ack(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler_ack(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
- struct cli_tree *tree = private;
+ struct smbcli_tree *tree = private;
break_info.fnum = fnum;
break_info.level = level;
break_info.count++;
printf("Acking in oplock handler\n");
- return cli_oplock_ack(tree, fnum, level);
+ return smbcli_oplock_ack(tree, fnum, level);
}
/*
a handler function for oplock break requests - close the file
*/
-static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
+static BOOL oplock_handler_close(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
union smb_close io;
NTSTATUS status;
- struct cli_tree *tree = private;
+ struct smbcli_tree *tree = private;
break_info.fnum = fnum;
break_info.level = level;
@@ -87,7 +87,7 @@ static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid,
/*
test oplock ops
*/
-static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_oplock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const char *fname = "\\test_oplock.dat";
NTSTATUS status;
@@ -98,9 +98,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
uint16_t fnum=0, fnum2=0;
/* cleanup */
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
- cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
/*
base ntcreatex parms
@@ -133,7 +133,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
CHECK_VAL(break_info.count, 0);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
/*
with a batch oplock we get a break
@@ -159,11 +159,11 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.count, 1);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
printf("if we close on break then the unlink can succeed\n");
ZERO_STRUCT(break_info);
- cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
+ smbcli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
@@ -184,8 +184,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a self read should not cause a break\n");
ZERO_STRUCT(break_info);
- cli_close(cli->tree, fnum);
- cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+ smbcli_close(cli->tree, fnum);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -207,8 +207,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a 2nd open should give a break\n");
ZERO_STRUCT(break_info);
- cli_close(cli->tree, fnum);
- cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+ smbcli_close(cli->tree, fnum);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -230,8 +230,8 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("a 2nd open should get an oplock when we close instead of ack\n");
ZERO_STRUCT(break_info);
- cli_close(cli->tree, fnum);
- cli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
+ smbcli_close(cli->tree, fnum);
+ smbcli_oplock_handler(cli->transport, oplock_handler_close, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -255,11 +255,11 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.fnum, fnum2);
CHECK_VAL(break_info.level, 1);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
printf("open with batch oplock\n");
ZERO_STRUCT(break_info);
- cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -284,9 +284,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(break_info.fnum, 0);
CHECK_VAL(break_info.level, 0);
- cli_close(cli->tree, fnum);
- cli_close(cli->tree, fnum2);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
+ smbcli_unlink(cli->tree, fname);
printf("open with attributes only can create file\n");
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
@@ -302,7 +302,7 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Subsequent normal open should break oplock on attribute only open to level II\n");
ZERO_STRUCT(break_info);
- cli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
+ smbcli_oplock_handler(cli->transport, oplock_handler_ack, cli->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -317,9 +317,9 @@ static BOOL test_oplock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
done:
- cli_close(cli->tree, fnum);
- cli_close(cli->tree, fnum2);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum2);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -329,7 +329,7 @@ done:
*/
BOOL torture_raw_oplock(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 4bade0f6e2..251a2de85d 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -149,7 +149,7 @@ static union smb_fileinfo *fname_find(const char *name)
*/
BOOL torture_raw_qfileinfo(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
int i;
BOOL ret = True;
int count;
@@ -171,7 +171,7 @@ BOOL torture_raw_qfileinfo(int dummy)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -552,8 +552,8 @@ BOOL torture_raw_qfileinfo(int dummy)
NAME_CHECK("ALT_NAME_INFORMATION", alt_name_info, fname, STR_UNICODE);
/* and make sure we can open by alternate name */
- cli_close(cli->tree, fnum);
- fnum = cli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ smbcli_close(cli->tree, fnum);
+ fnum = smbcli_nt_create_full(cli->tree, correct_name, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
@@ -561,7 +561,7 @@ BOOL torture_raw_qfileinfo(int dummy)
NTCREATEX_DISP_OVERWRITE_IF,
0, 0);
if (fnum == -1) {
- printf("Unable to open by alt_name - %s\n", cli_errstr(cli->tree));
+ printf("Unable to open by alt_name - %s\n", smbcli_errstr(cli->tree));
ret = False;
}
@@ -704,8 +704,8 @@ BOOL torture_raw_qfileinfo(int dummy)
done:
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
torture_close_connection(cli);
talloc_destroy(mem_ctx);
diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c
index 775755ddcb..41bc09f94e 100644
--- a/source4/torture/raw/qfsinfo.c
+++ b/source4/torture/raw/qfsinfo.c
@@ -109,7 +109,7 @@ static union smb_fsinfo *find(const char *name)
*/
BOOL torture_raw_qfsinfo(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
int i;
BOOL ret = True;
int count;
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 5fba3f1b31..afec805cd4 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -76,7 +76,7 @@ static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
/*
test read ops
*/
-static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_read(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_read io;
NTSTATUS status;
@@ -90,18 +90,18 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READ\n");
io.generic.level = RAW_READ_READ;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -129,7 +129,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.read.in.fnum = fnum;
- cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+ smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.read.in.fnum = fnum;
@@ -165,7 +165,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.read.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -178,7 +178,7 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -192,9 +192,9 @@ static BOOL test_read(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -202,7 +202,7 @@ done:
/*
test lockread ops
*/
-static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_lockread(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_read io;
NTSTATUS status;
@@ -216,18 +216,18 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_LOCKREAD\n");
io.generic.level = RAW_READ_LOCKREAD;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -260,7 +260,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.lockread.in.fnum = fnum;
- cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+ smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.lockread.in.fnum = fnum;
@@ -270,7 +270,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
- cli_unlock(cli->tree, fnum, 0, 1);
+ smbcli_unlock(cli->tree, fnum, 0, 1);
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -286,7 +286,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.lockread.in.count = strlen(test_data);
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
- cli_unlock(cli->tree, fnum, 0, strlen(test_data));
+ smbcli_unlock(cli->tree, fnum, 0, strlen(test_data));
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -305,7 +305,7 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.lockread.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -313,16 +313,16 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.lockread.in.count = ~0;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
- cli_unlock(cli->tree, fnum, 1, strlen(test_data));
+ smbcli_unlock(cli->tree, fnum, 1, strlen(test_data));
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_BUFFER(buf, seed, io.lockread.out.nread);
- cli_unlock(cli->tree, fnum, 0, 0xFFFF);
+ smbcli_unlock(cli->tree, fnum, 0, 0xFFFF);
printf("Trying locked region\n");
cli->session->pid++;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -336,8 +336,8 @@ static BOOL test_lockread(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
- cli_close(cli->tree, fnum);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_close(cli->tree, fnum);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -345,7 +345,7 @@ done:
/*
test readx ops
*/
-static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_readx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_read io;
NTSTATUS status;
@@ -359,17 +359,17 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READX\n");
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -404,7 +404,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
io.readx.in.fnum = fnum;
- cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+ smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.readx.in.fnum = fnum;
@@ -449,7 +449,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readx.out.compaction_mode, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -489,7 +489,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -510,7 +510,7 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readx.out.nread, 0);
- if (NT_STATUS_IS_ERR(cli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -521,8 +521,8 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readx.out.nread, 0);
done:
- cli_close(cli->tree, fnum);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_close(cli->tree, fnum);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -530,7 +530,7 @@ done:
/*
test readbraw ops
*/
-static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_readbraw(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_read io;
NTSTATUS status;
@@ -544,17 +544,17 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_READ_READBRAW\n");
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -586,7 +586,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readbraw.out.nread, 0);
io.readbraw.in.fnum = fnum;
- cli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
+ smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
printf("Trying small read\n");
io.readbraw.in.fnum = fnum;
@@ -624,7 +624,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readbraw.out.nread, 0);
setup_buffer(buf, seed, maxsize);
- cli_write(cli->tree, fnum, 0, buf, 0, maxsize);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, maxsize);
memset(buf, 0, maxsize);
printf("Trying large read\n");
@@ -658,7 +658,7 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -692,8 +692,8 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.readbraw.out.nread, 0);
done:
- cli_close(cli->tree, fnum);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_close(cli->tree, fnum);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -703,7 +703,7 @@ done:
*/
BOOL torture_raw_read(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 98a6ce5fde..e75d9d0fc7 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -40,7 +40,7 @@
/*
test SMBmv ops
*/
-static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_rename io;
NTSTATUS status;
@@ -51,9 +51,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Testing SMBmv\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -118,9 +118,9 @@ static BOOL test_mv(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -129,7 +129,7 @@ done:
/*
test SMBntrename ops
*/
-static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_ntrename(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_rename io;
NTSTATUS status;
@@ -141,9 +141,9 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Testing SMBntrename\n");
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -222,7 +222,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli->tree, fname2);
+ smbcli_unlink(cli->tree, fname2);
finfo.generic.in.fname = fname1;
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -254,7 +254,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
- cli_unlink(cli->tree, fname2);
+ smbcli_unlink(cli->tree, fname2);
finfo.generic.in.fname = fname1;
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
@@ -303,15 +303,15 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#if 0
{
char buf[16384];
- fnum = cli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname1, O_RDWR, DENY_NONE);
memset(buf, 1, sizeof(buf));
- cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+ smbcli_close(cli->tree, fnum);
- fnum = cli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname2, O_RDWR, DENY_NONE);
memset(buf, 1, sizeof(buf));
- cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
- cli_close(cli->tree, fnum);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf)-1);
+ smbcli_close(cli->tree, fnum);
torture_all_info(cli->tree, fname1);
torture_all_info(cli->tree, fname2);
@@ -353,7 +353,7 @@ static BOOL test_ntrename(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -363,7 +363,7 @@ done:
*/
BOOL torture_raw_rename(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 698f405fb4..55dd732e6a 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -38,7 +38,7 @@ static BOOL single_search_callback(void *private, union smb_search_data *file)
/*
do a single file (non-wildcard) search
*/
-static NTSTATUS single_search(struct cli_state *cli,
+static NTSTATUS single_search(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
const char *pattern,
enum smb_search_level level,
@@ -102,7 +102,7 @@ static union smb_search_data *find(const char *name)
/*
basic testing of all RAW_SEARCH_* calls using a single file
*/
-static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
BOOL ret = True;
int fnum;
@@ -116,7 +116,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
fnum = create_complex_file(cli, mem_ctx, fname);
if (fnum == -1) {
- printf("ERROR: open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -356,7 +356,7 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
return ret;
}
@@ -391,7 +391,7 @@ enum continue_type {CONT_FLAGS, CONT_NAME, CONT_RESUME_KEY};
/*
do a single file (non-wildcard) search
*/
-static NTSTATUS multiple_search(struct cli_state *cli,
+static NTSTATUS multiple_search(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
const char *pattern,
enum smb_search_level level,
@@ -539,7 +539,7 @@ static int search_old_compare(union smb_search_data *d1, union smb_search_data *
/*
basic testing of search calls using many files
*/
-static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
const int num_files = 700;
int i, fnum, t;
@@ -568,9 +568,9 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
{"SEARCH", "ID", RAW_SEARCH_SEARCH, CONT_RESUME_KEY}
};
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree));
return False;
}
@@ -578,14 +578,14 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
for (i=0;i<num_files;i++) {
asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i);
- fnum = cli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
free(fname);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
}
@@ -645,7 +645,7 @@ static BOOL test_many_files(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -656,7 +656,7 @@ done:
*/
BOOL torture_raw_search(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c
index 89528c72ad..b78efc0da4 100644
--- a/source4/torture/raw/seek.c
+++ b/source4/torture/raw/seek.c
@@ -41,7 +41,7 @@
/*
test seek ops
*/
-static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
struct smb_seek io;
union smb_fileinfo finfo;
@@ -52,15 +52,15 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
const char *fname = BASEDIR "\\test.txt";
char c[2];
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- printf("Failed to open test.txt - %s\n", cli_errstr(cli->tree));
+ printf("Failed to open test.txt - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -138,8 +138,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("trying write to update offset\n");
ZERO_STRUCT(c);
- if (cli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
- printf("Write failed - %s\n", cli_errstr(cli->tree));
+ if (smbcli_write(cli->tree, fnum, 0, c, 0, 2) != 2) {
+ printf("Write failed - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -158,8 +158,8 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.out.offset, 2);
- if (cli_read(cli->tree, fnum, c, 0, 1) != 1) {
- printf("Read failed - %s\n", cli_errstr(cli->tree));
+ if (smbcli_read(cli->tree, fnum, c, 0, 1) != 1) {
+ printf("Read failed - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -176,9 +176,9 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.out.offset, 1);
printf("Testing position information\n");
- fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("2nd open failed - %s\n", cli_errstr(cli->tree));
+ printf("2nd open failed - %s\n", smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -223,7 +223,7 @@ static BOOL test_seek(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -233,7 +233,7 @@ done:
*/
BOOL torture_raw_seek(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index fb2e0633e8..2f86a32261 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -28,7 +28,7 @@
*/
BOOL torture_raw_sfileinfo(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
int fnum_saved, d_fnum, fnum2, fnum = -1;
@@ -55,22 +55,22 @@ BOOL torture_raw_sfileinfo(int dummy)
mem_ctx = talloc_init("torture_sfileinfo");
- cli_deltree(cli->tree, BASEDIR);
- cli_mkdir(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
+ smbcli_mkdir(cli->tree, BASEDIR);
#define RECREATE_FILE(fname) do { \
- if (fnum != -1) cli_close(cli->tree, fnum); \
+ if (fnum != -1) smbcli_close(cli->tree, fnum); \
fnum = create_complex_file(cli, mem_ctx, fname); \
if (fnum == -1) { \
printf("(%d) ERROR: open of %s failed (%s)\n", \
- __LINE__, fname, cli_errstr(cli->tree)); \
+ __LINE__, fname, smbcli_errstr(cli->tree)); \
ret = False; \
goto done; \
}} while (0)
#define RECREATE_BOTH do { \
RECREATE_FILE(path_fname); \
- cli_close(cli->tree, fnum); \
+ smbcli_close(cli->tree, fnum); \
RECREATE_FILE(fnum_fname); \
} while (0)
@@ -408,8 +408,8 @@ BOOL torture_raw_sfileinfo(int dummy)
CHECK_VALUE(MODE_INFORMATION, mode_information, mode, 0);
#if 1
printf("finally the rename_information level\n");
- cli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
- cli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
+ smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, fnum_fname_new));
+ smbcli_close(cli->tree, create_complex_file(cli, mem_ctx, path_fname_new));
sfinfo.rename_information.in.overwrite = 0;
sfinfo.rename_information.in.root_fid = 0;
@@ -444,7 +444,7 @@ BOOL torture_raw_sfileinfo(int dummy)
printf("Trying rename with dest file open and delete_on_close\n");
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_ACCESS_DENIED);
- cli_close(cli->tree, fnum2);
+ smbcli_close(cli->tree, fnum2);
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname);
@@ -459,7 +459,7 @@ BOOL torture_raw_sfileinfo(int dummy)
sfinfo.rename_information.in.overwrite = 0;
CHECK_CALL_FNUM(RENAME_INFORMATION, NT_STATUS_OK);
CHECK_STR(NAME_INFO, name_info, fname.s, fnum_fname_new);
- cli_close(cli->tree, fnum2);
+ smbcli_close(cli->tree, fnum2);
sfinfo.rename_information.in.new_name = fnum_fname+strlen(BASEDIR)+1;
sfinfo.rename_information.in.overwrite = 0;
@@ -499,12 +499,12 @@ BOOL torture_raw_sfileinfo(int dummy)
done:
smb_raw_exit(cli->session);
- cli_close(cli->tree, fnum);
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fnum_fname))) {
- printf("Failed to delete %s - %s\n", fnum_fname, cli_errstr(cli->tree));
+ smbcli_close(cli->tree, fnum);
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fnum_fname))) {
+ printf("Failed to delete %s - %s\n", fnum_fname, smbcli_errstr(cli->tree));
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, path_fname))) {
- printf("Failed to delete %s - %s\n", path_fname, cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, path_fname))) {
+ printf("Failed to delete %s - %s\n", path_fname, smbcli_errstr(cli->tree));
}
torture_close_connection(cli);
@@ -518,7 +518,7 @@ done:
*/
BOOL torture_raw_sfileinfo_bug(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
TALLOC_CTX *mem_ctx;
const char *fname = "\\bug3.txt";
union smb_setfileinfo sfinfo;
@@ -537,7 +537,7 @@ BOOL torture_raw_sfileinfo_bug(int dummy)
mem_ctx = talloc_init("torture_sfileinfo");
fnum = create_complex_file(cli, mem_ctx, fname);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
sfinfo.generic.level = RAW_SFILEINFO_STANDARD;
sfinfo.generic.file.fname = fname;
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index f4598bc1d7..0d2f36f37c 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -33,16 +33,16 @@
/*
test unlink ops
*/
-static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_unlink(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
struct smb_unlink io;
NTSTATUS status;
BOOL ret = True;
const char *fname = BASEDIR "\\test.txt";
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
@@ -52,7 +52,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_unlink(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
- cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+ smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
io.in.pattern = fname;
io.in.attrib = 0;
@@ -60,7 +60,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
printf("Trying a hidden file\n");
- cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+ smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
torture_set_file_attribute(cli->tree, fname, FILE_ATTRIBUTE_HIDDEN);
io.in.pattern = fname;
@@ -101,7 +101,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
printf("Trying wildcards\n");
- cli_close(cli->tree, cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
+ smbcli_close(cli->tree, smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE));
io.in.pattern = BASEDIR "\\t*.t";
io.in.attrib = 0;
status = smb_raw_unlink(cli->tree, &io);
@@ -128,7 +128,7 @@ static BOOL test_unlink(struct cli_state *cli, TALLOC_CTX *mem_ctx)
done:
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -138,7 +138,7 @@ done:
*/
BOOL torture_raw_unlink(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index 8873ca5ae8..77c73a42b4 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -89,7 +89,7 @@ static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
/*
test write ops
*/
-static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_write io;
NTSTATUS status;
@@ -103,18 +103,18 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITE\n");
io.generic.level = RAW_WRITE_WRITE;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -140,7 +140,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.write.out.nwritten, io.write.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -159,7 +159,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.write.out.nwritten, 4000);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -190,7 +190,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.write.in.count + (uint64_t)io.write.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -198,9 +198,9 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -208,7 +208,7 @@ done:
/*
test writex ops
*/
-static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_write io;
NTSTATUS status;
@@ -222,18 +222,18 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITEX\n");
io.generic.level = RAW_WRITE_WRITEX;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -260,7 +260,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writex.out.nwritten, io.writex.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -279,7 +279,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writex.out.nwritten, 4000);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -312,7 +312,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
printf("Trying locked region\n");
cli->session->pid++;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) {
printf("Failed to lock file at %d\n", __LINE__);
ret = False;
goto done;
@@ -340,7 +340,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -360,7 +360,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -372,9 +372,9 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
setup_buffer(buf, seed, maxsize);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -382,7 +382,7 @@ done:
/*
test write unlock ops
*/
-static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writeunlock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_write io;
NTSTATUS status;
@@ -396,18 +396,18 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITEUNLOCK\n");
io.generic.level = RAW_WRITE_WRITEUNLOCK;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -430,7 +430,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.data = buf;
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -439,14 +439,14 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(IVAL(buf,0), 0);
setup_buffer(buf, seed, maxsize);
- cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeunlock.out.nwritten, io.writeunlock.in.count);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -460,7 +460,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.count = 4000;
io.writeunlock.in.offset = 0;
io.writeunlock.in.data = buf;
- cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -470,7 +470,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -495,7 +495,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
io.writeunlock.in.count = 4000;
io.writeunlock.in.offset = 0xFFFFFFFF - 2000;
io.writeunlock.in.data = buf;
- cli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
+ smbcli_lock(cli->tree, fnum, io.writeunlock.in.offset, io.writeunlock.in.count,
0, WRITE_LOCK);
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -503,7 +503,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_ALL_INFO(io.writeunlock.in.count + (uint64_t)io.writeunlock.in.offset, size);
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -511,9 +511,9 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -521,7 +521,7 @@ done:
/*
test write close ops
*/
-static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_writeclose(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
union smb_write io;
NTSTATUS status;
@@ -535,18 +535,18 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
buf = talloc_zero(mem_ctx, maxsize);
- if (cli_deltree(cli->tree, BASEDIR) == -1 ||
- NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) {
- printf("Unable to setup %s - %s\n", BASEDIR, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
+ NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
+ printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
return False;
}
printf("Testing RAW_WRITE_WRITECLOSE\n");
io.generic.level = RAW_WRITE_WRITECLOSE;
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
- printf("Failed to create %s - %s\n", fname, cli_errstr(cli->tree));
+ printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
ret = False;
goto done;
}
@@ -577,10 +577,10 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
- fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -593,11 +593,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeclose.out.nwritten, io.writeclose.in.count);
- fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 13) != 13) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -618,11 +618,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE);
- fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -652,11 +652,11 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VALUE(io.writeclose.out.nwritten, 4000);
CHECK_ALL_INFO(io.writeclose.in.count + (uint64_t)io.writeclose.in.offset, size);
- fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
memset(buf, 0, maxsize);
- if (cli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
+ if (smbcli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) {
printf("read failed at %d\n", __LINE__);
ret = False;
goto done;
@@ -664,9 +664,9 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_BUFFER(buf, seed, 4000);
done:
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
smb_raw_exit(cli->session);
- cli_deltree(cli->tree, BASEDIR);
+ smbcli_deltree(cli->tree, BASEDIR);
return ret;
}
@@ -676,7 +676,7 @@ done:
*/
BOOL torture_raw_write(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 90f6226200..78a15d22fd 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -25,7 +25,7 @@ int torture_numops=100;
int torture_entries=1000;
int torture_failures=1;
static int procnum; /* records process count number when forking */
-static struct cli_state *current_cli;
+static struct smbcli_state *current_cli;
static BOOL use_oplocks;
static BOOL use_level_II_oplocks;
static BOOL use_kerberos;
@@ -34,11 +34,11 @@ BOOL torture_showall = False;
#define CHECK_MAX_FAILURES(label) do { if (++failures >= torture_failures) goto label; } while (0)
-static struct cli_state *open_nbt_connection(void)
+static struct smbcli_state *open_nbt_connection(void)
{
struct nmb_name called, calling;
struct in_addr ip;
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *host = lp_parm_string(-1, "torture", "host");
make_nmb_name(&calling, lp_netbios_name(), 0x0);
@@ -46,35 +46,35 @@ static struct cli_state *open_nbt_connection(void)
zero_ip(&ip);
- cli = cli_state_init();
+ cli = smbcli_state_init();
if (!cli) {
- printf("Failed initialize cli_struct to connect with %s\n", host);
+ printf("Failed initialize smbcli_struct to connect with %s\n", host);
return NULL;
}
- if (!cli_socket_connect(cli, host, &ip)) {
+ if (!smbcli_socket_connect(cli, host, &ip)) {
printf("Failed to connect with %s\n", host);
return cli;
}
cli->transport->socket->timeout = 120000; /* set a really long timeout (2 minutes) */
- if (!cli_transport_establish(cli, &calling, &called)) {
+ if (!smbcli_transport_establish(cli, &calling, &called)) {
/*
* Well, that failed, try *SMBSERVER ...
* However, we must reconnect as well ...
*/
- if (!cli_socket_connect(cli, host, &ip)) {
+ if (!smbcli_socket_connect(cli, host, &ip)) {
printf("Failed to connect with %s\n", host);
return False;
}
make_nmb_name(&called, "*SMBSERVER", 0x20);
- if (!cli_transport_establish(cli, &calling, &called)) {
+ if (!smbcli_transport_establish(cli, &calling, &called)) {
printf("%s rejected the session\n",host);
printf("We tried with a called name of %s & %s\n",
host, "*SMBSERVER");
- cli_shutdown(cli);
+ smbcli_shutdown(cli);
return NULL;
}
}
@@ -82,7 +82,7 @@ static struct cli_state *open_nbt_connection(void)
return cli;
}
-BOOL torture_open_connection_share(struct cli_state **c,
+BOOL torture_open_connection_share(struct smbcli_state **c,
const char *hostname,
const char *sharename)
{
@@ -93,9 +93,9 @@ BOOL torture_open_connection_share(struct cli_state **c,
const char *password = lp_parm_string(-1, "torture", "password");
if (use_kerberos)
- flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
+ flags |= SMBCLI_FULL_CONNECTION_USE_KERBEROS;
- status = cli_full_connection(c, lp_netbios_name(),
+ status = smbcli_full_connection(c, lp_netbios_name(),
hostname, NULL,
sharename, "?????",
username, username[0]?lp_workgroup():"",
@@ -112,7 +112,7 @@ BOOL torture_open_connection_share(struct cli_state **c,
return True;
}
-BOOL torture_open_connection(struct cli_state **c)
+BOOL torture_open_connection(struct smbcli_state **c)
{
const char *host = lp_parm_string(-1, "torture", "host");
const char *share = lp_parm_string(-1, "torture", "share");
@@ -122,17 +122,17 @@ BOOL torture_open_connection(struct cli_state **c)
-BOOL torture_close_connection(struct cli_state *c)
+BOOL torture_close_connection(struct smbcli_state *c)
{
BOOL ret = True;
- DEBUG(9,("torture_close_connection: cli_state@%p\n", c));
+ DEBUG(9,("torture_close_connection: smbcli_state@%p\n", c));
if (!c) return True;
- if (NT_STATUS_IS_ERR(cli_tdis(c))) {
- printf("tdis failed (%s)\n", cli_errstr(c->tree));
+ if (NT_STATUS_IS_ERR(smbcli_tdis(c))) {
+ printf("tdis failed (%s)\n", smbcli_errstr(c->tree));
ret = False;
}
- DEBUG(9,("torture_close_connection: call cli_shutdown\n"));
- cli_shutdown(c);
+ DEBUG(9,("torture_close_connection: call smbcli_shutdown\n"));
+ smbcli_shutdown(c);
DEBUG(9,("torture_close_connection: exit\n"));
return ret;
}
@@ -169,16 +169,16 @@ NTSTATUS torture_rpc_close(struct dcerpc_pipe *p)
/* check if the server produced the expected error code */
-static BOOL check_error(int line, struct cli_state *c,
+static BOOL check_error(int line, struct smbcli_state *c,
uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
{
- if (cli_is_dos_error(c->tree)) {
+ if (smbcli_is_dos_error(c->tree)) {
uint8_t class;
uint32_t num;
/* Check DOS error */
- cli_dos_error(c, &class, &num);
+ smbcli_dos_error(c, &class, &num);
if (eclass != class || ecode != num) {
printf("unexpected error code class=%d code=%d\n",
@@ -193,7 +193,7 @@ static BOOL check_error(int line, struct cli_state *c,
/* Check NT error */
- status = cli_nt_error(c->tree);
+ status = smbcli_nt_error(c->tree);
if (NT_STATUS_V(nterr) != NT_STATUS_V(status)) {
printf("unexpected error code %s\n", nt_errstr(status));
@@ -206,16 +206,16 @@ static BOOL check_error(int line, struct cli_state *c,
}
-static BOOL wait_lock(struct cli_state *c, int fnum, uint32_t offset, uint32_t len)
+static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
{
- while (NT_STATUS_IS_ERR(cli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
+ while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
if (!check_error(__LINE__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False;
}
return True;
}
-static BOOL rw_torture(struct cli_state *c)
+static BOOL rw_torture(struct smbcli_state *c)
{
const char *lockfname = "\\torture.lck";
char *fname;
@@ -226,12 +226,12 @@ static BOOL rw_torture(struct cli_state *c)
char buf[1024];
BOOL correct = True;
- fnum2 = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
DENY_NONE);
if (fnum2 == -1)
- fnum2 = cli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
+ fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("open of %s failed (%s)\n", lockfname, cli_errstr(c->tree));
+ printf("open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree));
return False;
}
@@ -247,31 +247,31 @@ static BOOL rw_torture(struct cli_state *c)
return False;
}
- fnum = cli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
+ fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL);
if (fnum == -1) {
- printf("open failed (%s)\n", cli_errstr(c->tree));
+ printf("open failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
break;
}
- if (cli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
- printf("write failed (%s)\n", cli_errstr(c->tree));
+ if (smbcli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
+ printf("write failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
for (j=0;j<50;j++) {
- if (cli_write(c->tree, fnum, 0, (char *)buf,
+ if (smbcli_write(c->tree, fnum, 0, (char *)buf,
sizeof(pid)+(j*sizeof(buf)),
sizeof(buf)) != sizeof(buf)) {
- printf("write failed (%s)\n", cli_errstr(c->tree));
+ printf("write failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
}
pid2 = 0;
- if (cli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
- printf("read failed (%s)\n", cli_errstr(c->tree));
+ if (smbcli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
+ printf("read failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
@@ -280,32 +280,32 @@ static BOOL rw_torture(struct cli_state *c)
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
- printf("close failed (%s)\n", cli_errstr(c->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
+ printf("close failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_unlink(c->tree, fname))) {
- printf("unlink failed (%s)\n", cli_errstr(c->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) {
+ printf("unlink failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
- printf("unlock failed (%s)\n", cli_errstr(c->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) {
+ printf("unlock failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
free(fname);
}
- cli_close(c->tree, fnum2);
- cli_unlink(c->tree, lockfname);
+ smbcli_close(c->tree, fnum2);
+ smbcli_unlink(c->tree, lockfname);
printf("%d\n", i);
return correct;
}
-static BOOL run_torture(struct cli_state *cli, int dummy)
+static BOOL run_torture(struct smbcli_state *cli, int dummy)
{
BOOL ret;
@@ -318,7 +318,7 @@ static BOOL run_torture(struct cli_state *cli, int dummy)
return ret;
}
-static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
+static BOOL rw_torture3(struct smbcli_state *c, const char *lockfname)
{
int fnum = -1;
uint_t i = 0;
@@ -337,11 +337,11 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
if (procnum == 0)
{
- fnum = cli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ fnum = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
DENY_NONE);
if (fnum == -1) {
printf("first open read/write of %s failed (%s)\n",
- lockfname, cli_errstr(c->tree));
+ lockfname, smbcli_errstr(c->tree));
return False;
}
}
@@ -349,13 +349,13 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
{
for (i = 0; i < 500 && fnum == -1; i++)
{
- fnum = cli_open(c->tree, lockfname, O_RDONLY,
+ fnum = smbcli_open(c->tree, lockfname, O_RDONLY,
DENY_NONE);
msleep(10);
}
if (fnum == -1) {
printf("second open read-only of %s failed (%s)\n",
- lockfname, cli_errstr(c->tree));
+ lockfname, smbcli_errstr(c->tree));
return False;
}
}
@@ -378,20 +378,20 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
sent = sizeof(buf) - count;
}
- if (cli_write(c->tree, fnum, 0, buf+count, count, (size_t)sent) != sent) {
- printf("write failed (%s)\n", cli_errstr(c->tree));
+ if (smbcli_write(c->tree, fnum, 0, buf+count, count, (size_t)sent) != sent) {
+ printf("write failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
}
else
{
- sent = cli_read(c->tree, fnum, buf_rd+count, count,
+ sent = smbcli_read(c->tree, fnum, buf_rd+count, count,
sizeof(buf)-count);
if (sent < 0)
{
printf("read failed offset:%d size:%d (%s)\n",
count, sizeof(buf)-count,
- cli_errstr(c->tree));
+ smbcli_errstr(c->tree));
correct = False;
sent = 0;
}
@@ -410,15 +410,15 @@ static BOOL rw_torture3(struct cli_state *c, const char *lockfname)
}
- if (NT_STATUS_IS_ERR(cli_close(c->tree, fnum))) {
- printf("close failed (%s)\n", cli_errstr(c->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) {
+ printf("close failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
return correct;
}
-static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
+static BOOL rw_torture2(struct smbcli_state *c1, struct smbcli_state *c2)
{
const char *lockfname = "\\torture2.lck";
int fnum1;
@@ -429,23 +429,23 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
BOOL correct = True;
ssize_t bytes_read, bytes_written;
- if (cli_deltree(c1->tree, lockfname) == -1) {
- printf("unlink failed (%s)\n", cli_errstr(c1->tree));
+ if (smbcli_deltree(c1->tree, lockfname) == -1) {
+ printf("unlink failed (%s)\n", smbcli_errstr(c1->tree));
}
- fnum1 = cli_open(c1->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
+ fnum1 = smbcli_open(c1->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
DENY_NONE);
if (fnum1 == -1) {
printf("first open read/write of %s failed (%s)\n",
- lockfname, cli_errstr(c1->tree));
+ lockfname, smbcli_errstr(c1->tree));
return False;
}
- fnum2 = cli_open(c2->tree, lockfname, O_RDONLY,
+ fnum2 = smbcli_open(c2->tree, lockfname, O_RDONLY,
DENY_NONE);
if (fnum2 == -1) {
printf("second open read-only of %s failed (%s)\n",
- lockfname, cli_errstr(c2->tree));
- cli_close(c1->tree, fnum1);
+ lockfname, smbcli_errstr(c2->tree));
+ smbcli_close(c1->tree, fnum1);
return False;
}
@@ -460,15 +460,15 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
generate_random_buffer(buf, buf_size);
- if ((bytes_written = cli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) {
- printf("write failed (%s)\n", cli_errstr(c1->tree));
+ if ((bytes_written = smbcli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) {
+ printf("write failed (%s)\n", smbcli_errstr(c1->tree));
printf("wrote %d, expected %d\n", bytes_written, buf_size);
correct = False;
break;
}
- if ((bytes_read = cli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) {
- printf("read failed (%s)\n", cli_errstr(c2->tree));
+ if ((bytes_read = smbcli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) {
+ printf("read failed (%s)\n", smbcli_errstr(c2->tree));
printf("read %d, expected %d\n", bytes_read, buf_size);
correct = False;
break;
@@ -482,17 +482,17 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
}
}
- if (NT_STATUS_IS_ERR(cli_close(c2->tree, fnum2))) {
- printf("close failed (%s)\n", cli_errstr(c2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(c2->tree, fnum2))) {
+ printf("close failed (%s)\n", smbcli_errstr(c2->tree));
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_close(c1->tree, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(c1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(c1->tree, fnum1))) {
+ printf("close failed (%s)\n", smbcli_errstr(c1->tree));
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_unlink(c1->tree, lockfname))) {
- printf("unlink failed (%s)\n", cli_errstr(c1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(c1->tree, lockfname))) {
+ printf("unlink failed (%s)\n", smbcli_errstr(c1->tree));
correct = False;
}
@@ -501,7 +501,7 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
static BOOL run_readwritetest(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
BOOL test1, test2 = True;
if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
@@ -529,7 +529,7 @@ static BOOL run_readwritetest(int dummy)
return (test1 && test2);
}
-static BOOL run_readwritemulti(struct cli_state *cli, int dummy)
+static BOOL run_readwritemulti(struct smbcli_state *cli, int dummy)
{
BOOL test;
@@ -552,7 +552,7 @@ static BOOL run_readwritemulti(struct cli_state *cli, int dummy)
*/
static BOOL run_locktest1(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
const char *fname = "\\lockt1.lck";
int fnum1, fnum2, fnum3;
time_t t1, t2;
@@ -564,31 +564,31 @@ static BOOL run_locktest1(int dummy)
printf("starting locktest1\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- fnum3 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+ fnum3 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
if (fnum3 == -1) {
- printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("open3 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
- printf("lock1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+ printf("lock1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
printf("lock2 succeeded! This is a locking bug\n");
return False;
} else {
@@ -600,7 +600,7 @@ static BOOL run_locktest1(int dummy)
lock_timeout = (6 + (random() % 20));
printf("Testing lock timeout with timeout=%u\n", lock_timeout);
t1 = time(NULL);
- if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK))) {
printf("lock3 succeeded! This is a locking bug\n");
return False;
} else {
@@ -615,12 +615,12 @@ static BOOL run_locktest1(int dummy)
printf("server slept for %u seconds for a %u second timeout\n",
(uint_t)(t2-t1), lock_timeout);
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+ printf("close1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
printf("lock4 succeeded! This is a locking bug\n");
return False;
} else {
@@ -628,18 +628,18 @@ static BOOL run_locktest1(int dummy)
NT_STATUS_FILE_LOCK_CONFLICT)) return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum3))) {
- printf("close3 failed (%s)\n", cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum3))) {
+ printf("close3 failed (%s)\n", smbcli_errstr(cli2->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, fname))) {
+ printf("unlink failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -662,14 +662,14 @@ static BOOL run_locktest1(int dummy)
*/
static BOOL run_tcon_test(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *fname = "\\tcontest.tmp";
int fnum1;
uint16_t cnum1, cnum2, cnum3;
uint16_t vuid1, vuid2;
char buf[4];
BOOL ret = True;
- struct cli_tree *tree1;
+ struct smbcli_tree *tree1;
const char *host = lp_parm_string(-1, "torture", "host");
const char *share = lp_parm_string(-1, "torture", "share");
const char *password = lp_parm_string(-1, "torture", "password");
@@ -680,13 +680,13 @@ static BOOL run_tcon_test(int dummy)
printf("starting tcontest\n");
- if (cli_deltree(cli->tree, fname) == -1) {
- printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, fname) == -1) {
+ printf("unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
@@ -694,16 +694,16 @@ static BOOL run_tcon_test(int dummy)
vuid1 = cli->session->vuid;
memset(&buf, 0, 4); /* init buf so valgrind won't complain */
- if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) {
- printf("initial write failed (%s)\n", cli_errstr(cli->tree));
+ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) {
+ printf("initial write failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
tree1 = cli->tree; /* save old tree connection */
- if (NT_STATUS_IS_ERR(cli_send_tconX(cli, share, "?????", password))) {
+ if (NT_STATUS_IS_ERR(smbcli_send_tconX(cli, share, "?????", password))) {
printf("%s refused 2nd tree connect (%s)\n", host,
- cli_errstr(cli->tree));
- cli_shutdown(cli);
+ smbcli_errstr(cli->tree));
+ smbcli_shutdown(cli);
return False;
}
@@ -714,47 +714,47 @@ static BOOL run_tcon_test(int dummy)
/* try a write with the wrong tid */
cli->tree->tid = cnum2;
- if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
printf("* server allows write with wrong TID\n");
ret = False;
} else {
- printf("server fails write with wrong TID : %s\n", cli_errstr(cli->tree));
+ printf("server fails write with wrong TID : %s\n", smbcli_errstr(cli->tree));
}
/* try a write with an invalid tid */
cli->tree->tid = cnum3;
- if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
printf("* server allows write with invalid TID\n");
ret = False;
} else {
- printf("server fails write with invalid TID : %s\n", cli_errstr(cli->tree));
+ printf("server fails write with invalid TID : %s\n", smbcli_errstr(cli->tree));
}
/* try a write with an invalid vuid */
cli->session->vuid = vuid2;
cli->tree->tid = cnum1;
- if (cli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
+ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) {
printf("* server allows write with invalid VUID\n");
ret = False;
} else {
- printf("server fails write with invalid VUID : %s\n", cli_errstr(cli->tree));
+ printf("server fails write with invalid VUID : %s\n", smbcli_errstr(cli->tree));
}
cli->session->vuid = vuid1;
cli->tree->tid = cnum1;
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
- printf("close failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) {
+ printf("close failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
cli->tree->tid = cnum2;
- if (NT_STATUS_IS_ERR(cli_tdis(cli))) {
- printf("secondary tdis failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_tdis(cli))) {
+ printf("secondary tdis failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
@@ -770,7 +770,7 @@ static BOOL run_tcon_test(int dummy)
-static BOOL tcon_devtest(struct cli_state *cli,
+static BOOL tcon_devtest(struct smbcli_state *cli,
const char *myshare, const char *devtype,
NTSTATUS expected_error)
{
@@ -778,7 +778,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
BOOL ret;
const char *password = lp_parm_string(-1, "torture", "password");
- status = NT_STATUS_IS_OK(cli_send_tconX(cli, myshare, devtype,
+ status = NT_STATUS_IS_OK(smbcli_send_tconX(cli, myshare, devtype,
password));
printf("Trying share %s with devtype %s\n", myshare, devtype);
@@ -792,7 +792,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
myshare, devtype);
ret = False;
}
- cli_tdis(cli);
+ smbcli_tdis(cli);
} else {
if (status) {
printf("tconx to share %s with type %s "
@@ -800,7 +800,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
myshare, devtype);
ret = False;
} else {
- if (NT_STATUS_EQUAL(cli_nt_error(cli->tree),
+ if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),
expected_error)) {
ret = True;
} else {
@@ -817,7 +817,7 @@ static BOOL tcon_devtest(struct cli_state *cli,
*/
static BOOL run_tcon_devtype_test(int dummy)
{
- struct cli_state *cli1 = NULL;
+ struct smbcli_state *cli1 = NULL;
BOOL retry;
int flags = 0;
NTSTATUS status;
@@ -827,7 +827,7 @@ static BOOL run_tcon_devtype_test(int dummy)
const char *username = lp_parm_string(-1, "torture", "username");
const char *password = lp_parm_string(-1, "torture", "password");
- status = cli_full_connection(&cli1, lp_netbios_name(),
+ status = smbcli_full_connection(&cli1, lp_netbios_name(),
host, NULL,
share, "?????",
username, lp_workgroup(),
@@ -868,7 +868,7 @@ static BOOL run_tcon_devtype_test(int dummy)
if (!tcon_devtest(cli1, share, "FOOBA", NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
- cli_shutdown(cli1);
+ smbcli_shutdown(cli1);
if (ret)
printf("Passed tcondevtest\n");
@@ -890,7 +890,7 @@ static BOOL run_tcon_devtype_test(int dummy)
*/
static BOOL run_locktest2(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *fname = "\\lockt2.lck";
int fnum1, fnum2, fnum3;
BOOL correct = True;
@@ -901,40 +901,40 @@ static BOOL run_locktest2(int dummy)
printf("starting locktest2\n");
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
printf("Testing pid context\n");
cli->session->pid = 1;
- fnum1 = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
- fnum2 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
cli->session->pid = 2;
- fnum3 = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
+ fnum3 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
if (fnum3 == -1) {
- printf("open3 of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open3 of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
cli->session->pid = 1;
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
- printf("lock1 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+ printf("lock1 failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
printf("WRITE lock1 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -942,7 +942,7 @@ static BOOL run_locktest2(int dummy)
NT_STATUS_LOCK_NOT_GRANTED)) return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK))) {
printf("WRITE lock2 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -950,7 +950,7 @@ static BOOL run_locktest2(int dummy)
NT_STATUS_LOCK_NOT_GRANTED)) return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK))) {
printf("READ lock2 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -958,18 +958,18 @@ static BOOL run_locktest2(int dummy)
NT_STATUS_FILE_LOCK_CONFLICT)) return False;
}
- if (NT_STATUS_IS_ERR(cli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK))) {
- printf("lock at 100 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK))) {
+ printf("lock at 100 failed (%s)\n", smbcli_errstr(cli->tree));
}
cli->session->pid = 2;
- if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 100, 4))) {
+ if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 100, 4))) {
printf("unlock at 100 succeeded! This is a locking bug\n");
correct = False;
}
- if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 4))) {
+ if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 4))) {
printf("unlock1 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -978,7 +978,7 @@ static BOOL run_locktest2(int dummy)
NT_STATUS_RANGE_NOT_LOCKED)) return False;
}
- if (NT_STATUS_IS_OK(cli_unlock(cli->tree, fnum1, 0, 8))) {
+ if (NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 8))) {
printf("unlock2 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -987,7 +987,7 @@ static BOOL run_locktest2(int dummy)
NT_STATUS_RANGE_NOT_LOCKED)) return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK))) {
printf("lock3 succeeded! This is a locking bug\n");
correct = False;
} else {
@@ -996,18 +996,18 @@ static BOOL run_locktest2(int dummy)
cli->session->pid = 1;
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) {
+ printf("close1 failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum2))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum3))) {
- printf("close3 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum3))) {
+ printf("close3 failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
@@ -1028,7 +1028,7 @@ static BOOL run_locktest2(int dummy)
*/
static BOOL run_locktest3(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
const char *fname = "\\lockt3.lck";
int fnum1, fnum2, i;
uint32_t offset;
@@ -1044,16 +1044,16 @@ static BOOL run_locktest3(int dummy)
printf("Testing 32 bit offset ranges\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+ fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
if (fnum2 == -1) {
- printf("open2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("open2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
@@ -1061,17 +1061,17 @@ static BOOL run_locktest3(int dummy)
for (offset=i=0;i<torture_numops;i++) {
NEXT_OFFSET;
- if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
printf("lock1 %d failed (%s)\n",
i,
- cli_errstr(cli1->tree));
+ smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
printf("lock2 %d failed (%s)\n",
i,
- cli_errstr(cli1->tree));
+ smbcli_errstr(cli1->tree));
return False;
}
}
@@ -1081,22 +1081,22 @@ static BOOL run_locktest3(int dummy)
for (offset=i=0;i<torture_numops;i++) {
NEXT_OFFSET;
- if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, offset-2, 1, 0, WRITE_LOCK))) {
printf("error: lock1 %d succeeded!\n", i);
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, offset-1, 1, 0, WRITE_LOCK))) {
printf("error: lock2 %d succeeded!\n", i);
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, offset-1, 1, 0, WRITE_LOCK))) {
printf("error: lock3 %d succeeded!\n", i);
return False;
}
- if (NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
+ if (NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, offset-2, 1, 0, WRITE_LOCK))) {
printf("error: lock4 %d succeeded!\n", i);
return False;
}
@@ -1107,33 +1107,33 @@ static BOOL run_locktest3(int dummy)
for (offset=i=0;i<torture_numops;i++) {
NEXT_OFFSET;
- if (NT_STATUS_IS_ERR(cli_unlock(cli1->tree, fnum1, offset-1, 1))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlock(cli1->tree, fnum1, offset-1, 1))) {
printf("unlock1 %d failed (%s)\n",
i,
- cli_errstr(cli1->tree));
+ smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_unlock(cli2->tree, fnum2, offset-2, 1))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlock(cli2->tree, fnum2, offset-2, 1))) {
printf("unlock2 %d failed (%s)\n",
i,
- cli_errstr(cli1->tree));
+ smbcli_errstr(cli1->tree));
return False;
}
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("close2 failed (%s)\n", cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli2->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, fname))) {
- printf("unlink failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, fname))) {
+ printf("unlink failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -1159,7 +1159,7 @@ static BOOL run_locktest3(int dummy)
*/
static BOOL run_locktest4(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
const char *fname = "\\lockt4.lck";
int fnum1, fnum2, f;
BOOL ret;
@@ -1172,149 +1172,149 @@ static BOOL run_locktest4(int dummy)
printf("starting locktest4\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
- fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
memset(buf, 0, sizeof(buf));
- if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
printf("Failed to create file\n");
correct = False;
goto fail;
}
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK));
EXPECTED(ret, False);
printf("the same process %s set overlapping write locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the same process %s set overlapping read locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK));
EXPECTED(ret, False);
printf("a different connection %s set overlapping write locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("a different connection %s set overlapping read locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) &&
- NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)));
+ ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) &&
+ NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK)));
EXPECTED(ret, False);
printf("a different pid %s set overlapping write locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) &&
- NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)));
+ ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) &&
+ NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK)));
EXPECTED(ret, True);
printf("a different pid %s set overlapping read locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the same process %s set the same read lock twice\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK));
EXPECTED(ret, False);
printf("the same process %s set the same write lock twice\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK));
EXPECTED(ret, False);
printf("the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK((cli1->session->pid = 1, cli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) &&
- NT_STATUS_IS_OK((cli1->session->pid = 2, cli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)));
+ ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) &&
+ NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK)));
EXPECTED(ret, False);
printf("a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 110, 6));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 110, 6));
EXPECTED(ret, False);
printf("the same process %s coalesce read locks\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) &&
- (cli_read(cli2->tree, fnum2, buf, 120, 4) == 4);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) &&
+ (smbcli_read(cli2->tree, fnum2, buf, 120, 4) == 4);
EXPECTED(ret, False);
printf("this server %s strict write locking\n", ret?"doesn't do":"does");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) &&
- (cli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) &&
+ (smbcli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4);
EXPECTED(ret, False);
printf("this server %s strict read locking\n", ret?"doesn't do":"does");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 140, 4));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4));
EXPECTED(ret, True);
printf("this server %s do recursive read locking\n", ret?"does":"doesn't");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4)) &&
- (cli_read(cli2->tree, fnum2, buf, 150, 4) == 4) &&
- !(cli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 150, 4));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 150, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 150, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4)) &&
+ (smbcli_read(cli2->tree, fnum2, buf, 150, 4) == 4) &&
+ !(smbcli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4));
EXPECTED(ret, True);
printf("this server %s do recursive lock overlays\n", ret?"does":"doesn't");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 160, 4)) &&
- (cli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) &&
- (cli_read(cli2->tree, fnum2, buf, 160, 4) == 4);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 160, 4)) &&
+ (smbcli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) &&
+ (smbcli_read(cli2->tree, fnum2, buf, 160, 4) == 4);
EXPECTED(ret, True);
printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 170, 4)) &&
- (cli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) &&
- (cli_read(cli2->tree, fnum2, buf, 170, 4) == 4);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 170, 4)) &&
+ (smbcli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) &&
+ (smbcli_read(cli2->tree, fnum2, buf, 170, 4) == 4);
EXPECTED(ret, True);
printf("the same process %s remove a write lock using read locking\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 190, 4)) &&
- !(cli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) &&
- (cli_read(cli2->tree, fnum2, buf, 190, 4) == 4);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 190, 4)) &&
+ !(smbcli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) &&
+ (smbcli_read(cli2->tree, fnum2, buf, 190, 4) == 4);
EXPECTED(ret, True);
printf("the same process %s remove the first lock first\n", ret?"does":"doesn't");
- cli_close(cli1->tree, fnum1);
- cli_close(cli2->tree, fnum2);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
- f = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_close(cli1->tree, fnum1)) &&
- ((fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
- cli_close(cli1->tree, f);
- cli_close(cli1->tree, fnum1);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli2->tree, fnum2);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ f = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, f, 0, 1, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_close(cli1->tree, fnum1)) &&
+ ((fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE)) != -1) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
+ smbcli_close(cli1->tree, f);
+ smbcli_close(cli1->tree, fnum1);
EXPECTED(ret, True);
printf("the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't");
fail:
- cli_close(cli1->tree, fnum1);
- cli_close(cli2->tree, fnum2);
- cli_unlink(cli1->tree, fname);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli2->tree, fnum2);
+ smbcli_unlink(cli1->tree, fname);
torture_close_connection(cli1);
torture_close_connection(cli2);
@@ -1327,7 +1327,7 @@ static BOOL run_locktest4(int dummy)
*/
static BOOL run_locktest5(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
const char *fname = "\\lockt5.lck";
int fnum1, fnum2, fnum3;
BOOL ret;
@@ -1340,56 +1340,56 @@ static BOOL run_locktest5(int dummy)
printf("starting locktest5\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
- fnum2 = cli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
- fnum3 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum2 = smbcli_open(cli2->tree, fname, O_RDWR, DENY_NONE);
+ fnum3 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
memset(buf, 0, sizeof(buf));
- if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
printf("Failed to create file\n");
correct = False;
goto fail;
}
/* Check for NT bug... */
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK));
- cli_close(cli1->tree, fnum1);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 8, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 1, 0, READ_LOCK));
+ smbcli_close(cli1->tree, fnum1);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK));
EXPECTED(ret, True);
printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has");
- cli_close(cli1->tree, fnum1);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
- cli_unlock(cli1->tree, fnum3, 0, 1);
+ smbcli_close(cli1->tree, fnum1);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ smbcli_unlock(cli1->tree, fnum3, 0, 1);
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the same process %s overlay a write with a read lock\n", ret?"can":"cannot");
- ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
EXPECTED(ret, False);
printf("a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot");
/* Unlock the process 2 lock. */
- cli_unlock(cli2->tree, fnum2, 0, 4);
+ smbcli_unlock(cli2->tree, fnum2, 0, 4);
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK));
EXPECTED(ret, False);
printf("the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot");
/* Unlock the process 1 fnum3 lock. */
- cli_unlock(cli1->tree, fnum3, 0, 4);
+ smbcli_unlock(cli1->tree, fnum3, 0, 4);
/* Stack 2 more locks here. */
- ret = NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) &&
- NT_STATUS_IS_OK(cli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the same process %s stack read locks\n", ret?"can":"cannot");
@@ -1397,40 +1397,40 @@ static BOOL run_locktest5(int dummy)
/* Unlock the first process lock, then check this was the WRITE lock that was
removed. */
-ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
- NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
+ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) &&
+ NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK));
EXPECTED(ret, True);
printf("the first unlock removes the %s lock\n", ret?"WRITE":"READ");
/* Unlock the process 2 lock. */
- cli_unlock(cli2->tree, fnum2, 0, 4);
+ smbcli_unlock(cli2->tree, fnum2, 0, 4);
/* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */
- ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 1, 1)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
- NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4));
+ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 1, 1)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) &&
+ NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4));
EXPECTED(ret, True);
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->tree, fnum1, 0, 4));
+ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4));
EXPECTED(ret, False);
printf("the same process %s count the lock stack\n", !ret?"can":"cannot");
/* Ensure connection 2 can get a write lock. */
- ret = NT_STATUS_IS_OK(cli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK));
+ ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK));
EXPECTED(ret, True);
printf("a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot");
fail:
- cli_close(cli1->tree, fnum1);
- cli_close(cli2->tree, fnum2);
- cli_unlink(cli1->tree, fname);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli2->tree, fnum2);
+ smbcli_unlink(cli1->tree, fname);
if (!torture_close_connection(cli1)) {
correct = False;
}
@@ -1448,7 +1448,7 @@ ret = NT_STATUS_IS_OK(cli_unlock(cli1->tree, fnum1, 0, 4)) &&
*/
static BOOL run_locktest6(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *fname[1] = { "\\lock6.txt" };
int i;
int fnum;
@@ -1463,19 +1463,19 @@ static BOOL run_locktest6(int dummy)
for (i=0;i<1;i++) {
printf("Testing %s\n", fname[i]);
- cli_unlink(cli->tree, fname[i]);
+ smbcli_unlink(cli->tree, fname[i]);
- fnum = cli_open(cli->tree, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
- status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
- cli_close(cli->tree, fnum);
+ fnum = smbcli_open(cli->tree, fname[i], O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ status = smbcli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE);
+ smbcli_close(cli->tree, fnum);
printf("CHANGE_LOCKTYPE gave %s\n", nt_errstr(status));
- fnum = cli_open(cli->tree, fname[i], O_RDWR, DENY_NONE);
- status = cli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK);
- cli_close(cli->tree, fnum);
+ fnum = smbcli_open(cli->tree, fname[i], O_RDWR, DENY_NONE);
+ status = smbcli_locktype(cli->tree, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK);
+ smbcli_close(cli->tree, fnum);
printf("CANCEL_LOCK gave %s\n", nt_errstr(status));
- cli_unlink(cli->tree, fname[i]);
+ smbcli_unlink(cli->tree, fname[i]);
}
torture_close_connection(cli);
@@ -1486,7 +1486,7 @@ static BOOL run_locktest6(int dummy)
static BOOL run_locktest7(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
const char *fname = "\\lockt7.lck";
int fnum1;
int fnum2;
@@ -1500,36 +1500,36 @@ static BOOL run_locktest7(int dummy)
printf("starting locktest7\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
memset(buf, 0, sizeof(buf));
- if (cli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) {
printf("Failed to create file\n");
goto fail;
}
cli1->session->pid = 1;
- if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK))) {
- printf("Unable to apply read lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK))) {
+ printf("Unable to apply read lock on range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
goto fail;
} else {
printf("pid1 successfully locked range 130:4 for READ\n");
}
- if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
- printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+ printf("pid1 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
goto fail;
} else {
printf("pid1 successfully read the range 130:4\n");
}
- if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
- printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
- if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+ printf("pid1 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+ if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
goto fail;
}
@@ -1540,15 +1540,15 @@ static BOOL run_locktest7(int dummy)
cli1->session->pid = 2;
- if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
- printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+ printf("pid2 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
} else {
printf("pid2 successfully read the range 130:4\n");
}
- if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
- printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
- if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+ printf("pid2 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+ if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
goto fail;
}
@@ -1558,24 +1558,24 @@ static BOOL run_locktest7(int dummy)
}
cli1->session->pid = 1;
- cli_unlock(cli1->tree, fnum1, 130, 4);
+ smbcli_unlock(cli1->tree, fnum1, 130, 4);
- if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK))) {
- printf("Unable to apply write lock on range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, WRITE_LOCK))) {
+ printf("Unable to apply write lock on range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
goto fail;
} else {
printf("pid1 successfully locked range 130:4 for WRITE\n");
}
- if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
- printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+ printf("pid1 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
goto fail;
} else {
printf("pid1 successfully read the range 130:4\n");
}
- if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
- printf("pid1 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+ printf("pid1 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
goto fail;
} else {
printf("pid1 successfully wrote to the range 130:4\n");
@@ -1583,9 +1583,9 @@ static BOOL run_locktest7(int dummy)
cli1->session->pid = 2;
- if (cli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
- printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1->tree));
- if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+ if (smbcli_read(cli1->tree, fnum1, buf, 130, 4) != 4) {
+ printf("pid2 unable to read the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+ if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
goto fail;
}
@@ -1594,9 +1594,9 @@ static BOOL run_locktest7(int dummy)
goto fail;
}
- if (cli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
- printf("pid2 unable to write to the range 130:4, error was %s\n", cli_errstr(cli1->tree));
- if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 130, 4) != 4) {
+ printf("pid2 unable to write to the range 130:4, error was %s\n", smbcli_errstr(cli1->tree));
+ if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
goto fail;
}
@@ -1607,7 +1607,7 @@ static BOOL run_locktest7(int dummy)
printf("Testing truncate of locked file.\n");
- fnum2 = cli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
+ fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
if (fnum2 == -1) {
printf("Unable to truncate locked file.\n");
@@ -1617,8 +1617,8 @@ static BOOL run_locktest7(int dummy)
printf("Truncated locked file.\n");
}
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &size, NULL))) {
- printf("getatr failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &size, NULL))) {
+ printf("getatr failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
@@ -1631,13 +1631,13 @@ static BOOL run_locktest7(int dummy)
cli1->session->pid = 1;
- cli_unlock(cli1->tree, fnum1, 130, 4);
+ smbcli_unlock(cli1->tree, fnum1, 130, 4);
correct = True;
fail:
- cli_close(cli1->tree, fnum1);
- cli_close(cli1->tree, fnum2);
- cli_unlink(cli1->tree, fname);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli1->tree, fnum2);
+ smbcli_unlink(cli1->tree, fname);
torture_close_connection(cli1);
printf("finished locktest7\n");
@@ -1650,7 +1650,7 @@ security hole)
*/
static BOOL run_fdpasstest(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
const char *fname = "\\fdpass.tst";
int fnum1, oldtid;
pstring buf;
@@ -1661,20 +1661,20 @@ static BOOL run_fdpasstest(int dummy)
printf("starting fdpasstest\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("Opening a file on connection 1\n");
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
printf("writing to file on connection 1\n");
- if (cli_write(cli1->tree, fnum1, 0, "hello world\n", 0, 13) != 13) {
- printf("write failed (%s)\n", cli_errstr(cli1->tree));
+ if (smbcli_write(cli1->tree, fnum1, 0, "hello world\n", 0, 13) != 13) {
+ printf("write failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -1685,14 +1685,14 @@ static BOOL run_fdpasstest(int dummy)
printf("reading from file on connection 2\n");
- if (cli_read(cli2->tree, fnum1, buf, 0, 13) == 13) {
+ if (smbcli_read(cli2->tree, fnum1, buf, 0, 13) == 13) {
printf("read succeeded! nasty security hole [%s]\n",
buf);
return False;
}
- cli_close(cli1->tree, fnum1);
- cli_unlink(cli1->tree, fname);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_unlink(cli1->tree, fname);
cli2->tree->tid = oldtid;
@@ -1711,7 +1711,7 @@ static BOOL run_fdpasstest(int dummy)
*/
static BOOL run_unlinktest(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *fname = "\\unlink.tst";
int fnum;
BOOL correct = True;
@@ -1722,21 +1722,21 @@ static BOOL run_unlinktest(int dummy)
printf("starting unlink test\n");
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
cli->session->pid = 1;
printf("Opening a file\n");
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
printf("Unlinking a open file\n");
- if (NT_STATUS_IS_OK(cli_unlink(cli->tree, fname))) {
+ if (NT_STATUS_IS_OK(smbcli_unlink(cli->tree, fname))) {
printf("error: server allowed unlink on an open file\n");
correct = False;
} else {
@@ -1744,8 +1744,8 @@ static BOOL run_unlinktest(int dummy)
NT_STATUS_SHARING_VIOLATION);
}
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
if (!torture_close_connection(cli)) {
correct = False;
@@ -1760,7 +1760,7 @@ static BOOL run_unlinktest(int dummy)
/*
test the timing of deferred open requests
*/
-static BOOL run_deferopen(struct cli_state *cli, int dummy)
+static BOOL run_deferopen(struct smbcli_state *cli, int dummy)
{
const char *fname = "\\defer_open_test.dat";
int retries=4;
@@ -1780,14 +1780,14 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
do {
struct timeval tv_start, tv_end;
GetTimeOfDay(&tv_start);
- fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE,
NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum != -1) {
break;
}
GetTimeOfDay(&tv_end);
- if (NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+ if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
/* Sharing violation errors need to be 1 second apart. */
int64_t tdif = usec_time_diff(&tv_end, &tv_start);
if (tdif < 500000 || tdif > 1500000) {
@@ -1796,10 +1796,10 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
tdif % (int64_t)1000000);
}
}
- } while (NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
+ } while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
if (fnum == -1) {
- fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+ fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return False;
}
@@ -1807,17 +1807,17 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
sleep(10);
i++;
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
- fprintf(stderr,"Failed to close %s, error=%s\n", fname, cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+ fprintf(stderr,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return False;
}
sleep(2);
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
/* All until the last unlink will fail with sharing violation. */
- if (!NT_STATUS_EQUAL(cli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
- printf("unlink of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ if (!NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+ printf("unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
correct = False;
}
}
@@ -1832,7 +1832,7 @@ static BOOL run_deferopen(struct cli_state *cli, int dummy)
/*
test how many open files this server supports on the one socket
*/
-static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
+static BOOL run_maxfidtest(struct smbcli_state *cli, int dummy)
{
const char *template = "\\maxfid.%d.%d";
char *fname;
@@ -1849,11 +1849,11 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
for (i=0; i<0x11000; i++) {
asprintf(&fname, template, i,(int)getpid());
- if ((fnums[i] = cli_open(cli->tree, fname,
+ if ((fnums[i] = smbcli_open(cli->tree, fname,
O_RDWR|O_CREAT|O_TRUNC, DENY_NONE)) ==
-1) {
printf("open of %s failed (%s)\n",
- fname, cli_errstr(cli->tree));
+ fname, smbcli_errstr(cli->tree));
printf("maximum fnum is %d\n", i);
break;
}
@@ -1866,12 +1866,12 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
printf("cleaning up\n");
for (;i>=0;i--) {
asprintf(&fname, template, i,(int)getpid());
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnums[i]))) {
- printf("Close of fnum %d failed - %s\n", fnums[i], cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnums[i]))) {
+ printf("Close of fnum %d failed - %s\n", fnums[i], smbcli_errstr(cli->tree));
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli->tree, fname))) {
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
printf("unlink of %s failed (%s)\n",
- fname, cli_errstr(cli->tree));
+ fname, smbcli_errstr(cli->tree));
correct = False;
}
free(fname);
@@ -1890,7 +1890,7 @@ static BOOL run_maxfidtest(struct cli_state *cli, int dummy)
static BOOL run_negprot_nowait(int dummy)
{
int i;
- struct cli_state *cli, *cli2;
+ struct smbcli_state *cli, *cli2;
BOOL correct = True;
printf("starting negprot nowait test\n");
@@ -1903,18 +1903,18 @@ static BOOL run_negprot_nowait(int dummy)
printf("Filling send buffer\n");
for (i=0;i<10000;i++) {
- struct cli_request *req;
+ struct smbcli_request *req;
time_t t1 = time(NULL);
req = smb_negprot_send(cli->transport, PROTOCOL_NT1);
- while (req->state == CLI_REQUEST_SEND && time(NULL) < t1+5) {
- cli_transport_process(cli->transport);
+ while (req->state == SMBCLI_REQUEST_SEND && time(NULL) < t1+5) {
+ smbcli_transport_process(cli->transport);
}
- if (req->state == CLI_REQUEST_ERROR) {
+ if (req->state == SMBCLI_REQUEST_ERROR) {
printf("Failed to fill pipe - %s\n", nt_errstr(req->status));
torture_close_connection(cli);
return correct;
}
- if (req->state == CLI_REQUEST_SEND) {
+ if (req->state == SMBCLI_REQUEST_SEND) {
break;
}
}
@@ -1953,7 +1953,7 @@ static BOOL run_negprot_nowait(int dummy)
*/
static BOOL run_attrtest(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
int fnum;
time_t t, t2;
const char *fname = "\\attrib123456789.tst";
@@ -1965,13 +1965,13 @@ static BOOL run_attrtest(int dummy)
return False;
}
- cli_unlink(cli->tree, fname);
- fnum = cli_open(cli->tree, fname,
+ smbcli_unlink(cli->tree, fname);
+ fnum = smbcli_open(cli->tree, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
- if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
- printf("getatr failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) {
+ printf("getatr failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
@@ -1988,13 +1988,13 @@ static BOOL run_attrtest(int dummy)
printf("Setting file time to %s", ctime(&t2));
- if (NT_STATUS_IS_ERR(cli_setatr(cli->tree, fname, 0, t2))) {
- printf("setatr failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, fname, 0, t2))) {
+ printf("setatr failed (%s)\n", smbcli_errstr(cli->tree));
correct = True;
}
- if (NT_STATUS_IS_ERR(cli_getatr(cli->tree, fname, NULL, NULL, &t))) {
- printf("getatr failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) {
+ printf("getatr failed (%s)\n", smbcli_errstr(cli->tree));
correct = True;
}
@@ -2007,7 +2007,7 @@ static BOOL run_attrtest(int dummy)
correct = True;
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
if (!torture_close_connection(cli)) {
correct = False;
@@ -2024,7 +2024,7 @@ static BOOL run_attrtest(int dummy)
*/
static BOOL run_trans2test(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
int fnum;
size_t size;
time_t c_time, a_time, m_time, w_time, m_time2;
@@ -2040,22 +2040,22 @@ static BOOL run_trans2test(int dummy)
return False;
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
printf("Testing qfileinfo\n");
- fnum = cli_open(cli->tree, fname,
+ fnum = smbcli_open(cli->tree, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
- if (NT_STATUS_IS_ERR(cli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
+ if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time,
NULL, NULL))) {
- printf("ERROR: qfileinfo failed (%s)\n", cli_errstr(cli->tree));
+ printf("ERROR: qfileinfo failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
printf("Testing NAME_INFO\n");
- if (NT_STATUS_IS_ERR(cli_qfilename(cli->tree, fnum, &pname))) {
- printf("ERROR: qfilename failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_qfilename(cli->tree, fnum, &pname))) {
+ printf("ERROR: qfilename failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
@@ -2065,21 +2065,21 @@ static BOOL run_trans2test(int dummy)
correct = False;
}
- cli_close(cli->tree, fnum);
- cli_unlink(cli->tree, fname);
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
- fnum = cli_open(cli->tree, fname,
+ fnum = smbcli_open(cli->tree, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
if (fnum == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
printf("Checking for sticky create times\n");
- if (NT_STATUS_IS_ERR(cli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) {
- printf("ERROR: qpathinfo failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) {
+ printf("ERROR: qpathinfo failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
} else {
if (c_time != m_time) {
@@ -2100,12 +2100,12 @@ static BOOL run_trans2test(int dummy)
}
- cli_unlink(cli->tree, fname);
- fnum = cli_open(cli->tree, fname,
+ smbcli_unlink(cli->tree, fname);
+ fnum = smbcli_open(cli->tree, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
- cli_close(cli->tree, fnum);
- if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
- printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+ smbcli_close(cli->tree, fnum);
+ if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
+ printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
} else {
if (w_time < 60*60*24*2) {
@@ -2115,27 +2115,27 @@ static BOOL run_trans2test(int dummy)
}
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
/* check if the server updates the directory modification time
when creating a new file */
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, dname))) {
- printf("ERROR: mkdir failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) {
+ printf("ERROR: mkdir failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
sleep(3);
- if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
- printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) {
+ printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
- fnum = cli_open(cli->tree, fname2,
+ fnum = smbcli_open(cli->tree, fname2,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
- cli_write(cli->tree, fnum, 0, (char *)&fnum, 0, sizeof(fnum));
- cli_close(cli->tree, fnum);
- if (NT_STATUS_IS_ERR(cli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
- printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli->tree));
+ smbcli_write(cli->tree, fnum, 0, (char *)&fnum, 0, sizeof(fnum));
+ smbcli_close(cli->tree, fnum);
+ if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
+ printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
} else {
if (m_time2 == m_time) {
@@ -2143,8 +2143,8 @@ static BOOL run_trans2test(int dummy)
correct = False;
}
}
- cli_unlink(cli->tree, fname2);
- cli_rmdir(cli->tree, dname);
+ smbcli_unlink(cli->tree, fname2);
+ smbcli_rmdir(cli->tree, dname);
if (!torture_close_connection(cli)) {
correct = False;
@@ -2160,8 +2160,8 @@ static BOOL run_trans2test(int dummy)
*/
static BOOL run_deletetest(int dummy)
{
- struct cli_state *cli1;
- struct cli_state *cli2 = NULL;
+ struct smbcli_state *cli1;
+ struct smbcli_state *cli2 = NULL;
const char *fname = "\\delete.file";
int fnum1 = -1;
int fnum2 = -1;
@@ -2175,26 +2175,26 @@ static BOOL run_deletetest(int dummy)
/* Test 1 - this should delete the file on close. */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF,
NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
if (fnum1 == -1) {
- printf("[1] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[1] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[1] close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[1] close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- fnum1 = cli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
if (fnum1 != -1) {
printf("[1] open of %s succeeded (should fail)\n", fname);
correct = False;
@@ -2205,52 +2205,52 @@ static BOOL run_deletetest(int dummy)
/* Test 2 - this should delete the file on close. */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE,
NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[2] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[2] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
- printf("[2] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ printf("[2] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[2] close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
if (fnum1 != -1) {
printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[2] close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[2] close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
} else
printf("second delete on close test succeeded.\n");
/* Test 3 - ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[3] open - 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[3] open - 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
@@ -2258,7 +2258,7 @@ static BOOL run_deletetest(int dummy)
/* This should fail with a sharing violation - open for delete is only compatible
with SHARE_DELETE. */
- fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE,
NTCREATEX_DISP_OPEN, 0, 0);
@@ -2270,52 +2270,52 @@ static BOOL run_deletetest(int dummy)
/* This should succeed. */
- fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN, 0, 0);
if (fnum2 == -1) {
- printf("[3] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[3] open - 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
- printf("[3] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ printf("[3] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[3] close 1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[3] close 1 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
- printf("[3] close 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+ printf("[3] close 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should fail - file should no longer be there. */
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
if (fnum1 != -1) {
printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[3] close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[3] close failed (%s)\n", smbcli_errstr(cli1->tree));
}
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
correct = False;
goto fail;
} else
printf("third delete on close test succeeded.\n");
/* Test 4 ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
SA_RIGHT_FILE_READ_DATA |
SA_RIGHT_FILE_WRITE_DATA |
STD_RIGHT_DELETE_ACCESS,
@@ -2324,38 +2324,38 @@ static BOOL run_deletetest(int dummy)
NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[4] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[4] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should succeed. */
- fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
+ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE |
NTCREATEX_SHARE_ACCESS_DELETE,
NTCREATEX_DISP_OPEN, 0, 0);
if (fnum2 == -1) {
- printf("[4] open - 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[4] open - 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
- printf("[4] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+ printf("[4] close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
- printf("[4] setting delete_on_close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ printf("[4] setting delete_on_close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should fail - no more opens once delete on close set. */
- fnum2 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
+ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
NTCREATEX_DISP_OPEN, 0, 0);
if (fnum2 != -1) {
@@ -2365,33 +2365,33 @@ static BOOL run_deletetest(int dummy)
} else
printf("fourth delete on close test succeeded.\n");
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[4] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[4] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* Test 5 ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[5] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should fail - only allowed on NT opens with DELETE access. */
- if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ if (NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n");
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[5] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[5] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
@@ -2399,10 +2399,10 @@ static BOOL run_deletetest(int dummy)
printf("fifth delete on close test succeeded.\n");
/* Test 6 ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
SA_RIGHT_FILE_READ_DATA | SA_RIGHT_FILE_WRITE_DATA,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ |
@@ -2411,21 +2411,21 @@ static BOOL run_deletetest(int dummy)
NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[6] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[6] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should fail - only allowed on NT opens with DELETE access. */
- if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ if (NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n");
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[6] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[6] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
@@ -2433,50 +2433,50 @@ static BOOL run_deletetest(int dummy)
printf("sixth delete on close test succeeded.\n");
/* Test 7 ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
SA_RIGHT_FILE_READ_DATA |
SA_RIGHT_FILE_WRITE_DATA |
STD_RIGHT_DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[7] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[7] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
printf("[7] setting delete_on_close on file failed !\n");
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, False))) {
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, False))) {
printf("[7] unsetting delete_on_close on file failed !\n");
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[7] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This next open should succeed - we reset the flag. */
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
if (fnum1 == -1) {
- printf("[5] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[5] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[7] close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[7] close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
@@ -2484,8 +2484,8 @@ static BOOL run_deletetest(int dummy)
printf("seventh delete on close test succeeded.\n");
/* Test 7 ... */
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
if (!torture_open_connection(&cli2)) {
printf("[8] failed to open second connection.\n");
@@ -2493,46 +2493,46 @@ static BOOL run_deletetest(int dummy)
goto fail;
}
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[8] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE,
NTCREATEX_DISP_OPEN, 0, 0);
if (fnum2 == -1) {
- printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[8] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_nt_delete_on_close(cli1->tree, fnum1, True))) {
+ if (NT_STATUS_IS_ERR(smbcli_nt_delete_on_close(cli1->tree, fnum1, True))) {
printf("[8] setting delete_on_close on file failed !\n");
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[8] close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[8] close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("[8] close - 2 failed (%s)\n", cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("[8] close - 2 failed (%s)\n", smbcli_errstr(cli2->tree));
correct = False;
goto fail;
}
/* This should fail.. */
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
if (fnum1 != -1) {
printf("[8] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
@@ -2541,7 +2541,7 @@ static BOOL run_deletetest(int dummy)
printf("eighth delete on close test succeeded.\n");
/* This should fail - we need to set DELETE_ACCESS. */
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
if (fnum1 != -1) {
@@ -2552,23 +2552,23 @@ static BOOL run_deletetest(int dummy)
printf("ninth delete on close test succeeded.\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA|STD_RIGHT_DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
if (fnum1 == -1) {
- printf("[10] open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("[10] open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should delete the file. */
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("[10] close failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("[10] close failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
goto fail;
}
/* This should fail.. */
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_NONE);
if (fnum1 != -1) {
printf("[10] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
@@ -2582,10 +2582,10 @@ static BOOL run_deletetest(int dummy)
* intialized, because these functions don't handle
* uninitialized connections. */
- cli_close(cli1->tree, fnum1);
- cli_close(cli1->tree, fnum2);
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_close(cli1->tree, fnum1);
+ smbcli_close(cli1->tree, fnum2);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
if (!torture_close_connection(cli1)) {
correct = False;
@@ -2602,7 +2602,7 @@ static BOOL run_deletetest(int dummy)
*/
static BOOL run_properties(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
BOOL correct = True;
printf("starting properties test\n");
@@ -2648,7 +2648,7 @@ static BOOL run_properties(int dummy)
*/
static BOOL run_xcopy(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
const char *fname = "\\test.txt";
BOOL correct = True;
int fnum1, fnum2;
@@ -2659,22 +2659,22 @@ static BOOL run_xcopy(int dummy)
return False;
}
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
FIRST_DESIRED_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF,
0x4044, 0);
if (fnum1 == -1) {
- printf("First open failed - %s\n", cli_errstr(cli1->tree));
+ printf("First open failed - %s\n", smbcli_errstr(cli1->tree));
return False;
}
- fnum2 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0,
SECOND_DESIRED_ACCESS, 0,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN,
0x200000, 0);
if (fnum2 == -1) {
- printf("second open failed - %s\n", cli_errstr(cli1->tree));
+ printf("second open failed - %s\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -2690,7 +2690,7 @@ static BOOL run_xcopy(int dummy)
*/
static BOOL run_rename(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
const char *fname = "\\test.txt";
const char *fname1 = "\\test1.txt";
BOOL correct = True;
@@ -2702,76 +2702,76 @@ static BOOL run_rename(int dummy)
return False;
}
- cli_unlink(cli1->tree, fname);
- cli_unlink(cli1->tree, fname1);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+ smbcli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname1);
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("First open failed - %s\n", cli_errstr(cli1->tree));
+ printf("First open failed - %s\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
- printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+ printf("First rename failed (this is correct) - %s\n", smbcli_errstr(cli1->tree));
} else {
printf("First rename succeeded - this should have failed !\n");
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close - 1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close - 1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- cli_unlink(cli1->tree, fname);
- cli_unlink(cli1->tree, fname1);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
+ smbcli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname1);
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, GENERIC_RIGHTS_FILE_READ, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE|NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("Second open failed - %s\n", cli_errstr(cli1->tree));
+ printf("Second open failed - %s\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
- printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+ printf("Second rename failed - this should have succeeded - %s\n", smbcli_errstr(cli1->tree));
correct = False;
} else {
printf("Second rename succeeded\n");
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close - 2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close - 2 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- cli_unlink(cli1->tree, fname);
- cli_unlink(cli1->tree, fname1);
+ smbcli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname1);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("Third open failed - %s\n", cli_errstr(cli1->tree));
+ printf("Third open failed - %s\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_rename(cli1->tree, fname, fname1))) {
- printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_rename(cli1->tree, fname, fname1))) {
+ printf("Third rename failed - this should have succeeded - %s\n", smbcli_errstr(cli1->tree));
correct = False;
} else {
printf("Third rename succeeded\n");
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close - 3 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close - 3 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- cli_unlink(cli1->tree, fname);
- cli_unlink(cli1->tree, fname1);
+ smbcli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname1);
if (!torture_close_connection(cli1)) {
correct = False;
@@ -2786,7 +2786,7 @@ static BOOL run_rename(int dummy)
*/
static BOOL run_pipe_number(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
const char *pipe_name = "\\WKSSVC";
int fnum;
int num_pipes = 0;
@@ -2797,11 +2797,11 @@ static BOOL run_pipe_number(int dummy)
}
while(1) {
- fnum = cli_nt_create_full(cli1->tree, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+ fnum = smbcli_nt_create_full(cli1->tree, pipe_name, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum == -1) {
- printf("Open of pipe %s failed with error (%s)\n", pipe_name, cli_errstr(cli1->tree));
+ printf("Open of pipe %s failed with error (%s)\n", pipe_name, smbcli_errstr(cli1->tree));
break;
}
num_pipes++;
@@ -2825,12 +2825,12 @@ static BOOL run_pipe_number(int dummy)
static BOOL torture_holdcon(int dummy)
{
int i;
- struct cli_state **cli;
+ struct smbcli_state **cli;
int num_dead = 0;
printf("Opening %d connections\n", torture_numops);
- cli = malloc(sizeof(struct cli_state *) * torture_numops);
+ cli = malloc(sizeof(struct smbcli_state *) * torture_numops);
for (i=0;i<torture_numops;i++) {
if (!torture_open_connection(&cli[i])) {
@@ -2846,7 +2846,7 @@ static BOOL run_pipe_number(int dummy)
for (i=0;i<torture_numops;i++) {
NTSTATUS status;
if (cli[i]) {
- status = cli_chkpath(cli[i]->tree, "\\");
+ status = smbcli_chkpath(cli[i]->tree, "\\");
if (!NT_STATUS_IS_OK(status)) {
printf("Connection %d is dead\n", i);
cli[i] = NULL;
@@ -2874,7 +2874,7 @@ static BOOL run_pipe_number(int dummy)
static BOOL run_vuidtest(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
const char *fname = "\\vuid.tst";
int fnum;
size_t size;
@@ -2890,9 +2890,9 @@ static BOOL run_vuidtest(int dummy)
return False;
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
- fnum = cli_open(cli->tree, fname,
+ fnum = smbcli_open(cli->tree, fname,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
orig_vuid = cli->session->vuid;
@@ -2901,7 +2901,7 @@ static BOOL run_vuidtest(int dummy)
printf("Testing qfileinfo with wrong vuid\n");
- if (NT_STATUS_IS_OK(result = cli_qfileinfo(cli->tree, fnum, NULL,
+ if (NT_STATUS_IS_OK(result = smbcli_qfileinfo(cli->tree, fnum, NULL,
&size, &c_time, &a_time,
&m_time, NULL, NULL))) {
printf("ERROR: qfileinfo passed with wrong vuid\n");
@@ -2913,18 +2913,18 @@ static BOOL run_vuidtest(int dummy)
(cli->transport->error.e.dos.ecode != ERRbaduid) ) {
printf("ERROR: qfileinfo should have returned DOS error "
"ERRSRV:ERRbaduid\n but returned %s\n",
- cli_errstr(cli->tree));
+ smbcli_errstr(cli->tree));
correct = False;
}
cli->session->vuid -= 1234;
- if (NT_STATUS_IS_ERR(cli_close(cli->tree, fnum))) {
- printf("close failed (%s)\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
+ printf("close failed (%s)\n", smbcli_errstr(cli->tree));
correct = False;
}
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
if (!torture_close_connection(cli)) {
correct = False;
@@ -2940,8 +2940,8 @@ static BOOL run_vuidtest(int dummy)
*/
static BOOL run_opentest(int dummy)
{
- static struct cli_state *cli1;
- static struct cli_state *cli2;
+ static struct smbcli_state *cli1;
+ static struct smbcli_state *cli2;
const char *fname = "\\readonly.file";
int fnum1, fnum2;
char buf[20];
@@ -2956,35 +2956,35 @@ static BOOL run_vuidtest(int dummy)
return False;
}
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) {
- printf("cli_setatr failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) {
+ printf("smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test1);
return False;
}
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test1);
return False;
}
/* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */
- fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
+ fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
if (check_error(__LINE__, cli1, ERRDOS, ERRnoaccess,
NT_STATUS_ACCESS_DENIED)) {
@@ -2993,40 +2993,40 @@ static BOOL run_vuidtest(int dummy)
printf("finished open test 1\n");
error_test1:
- cli_close(cli1->tree, fnum1);
+ smbcli_close(cli1->tree, fnum1);
/* Now try not readonly and ensure ERRbadshare is returned. */
- cli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
if (fnum1 == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
/* This will fail - but the error should be ERRshare. */
- fnum2 = cli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
+ fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL);
if (check_error(__LINE__, cli1, ERRDOS, ERRbadshare,
NT_STATUS_SHARING_VIOLATION)) {
printf("correct error code ERRDOS/ERRbadshare returned\n");
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("finished open test 2\n");
/* Test truncate open disposition on file opened for read. */
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum1 == -1) {
- printf("(3) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("(3) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
@@ -3034,19 +3034,19 @@ error_test1:
memset(buf, '\0', 20);
- if (cli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
- printf("write failed (%s)\n", cli_errstr(cli1->tree));
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
+ printf("write failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("(3) close1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("(3) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
/* Ensure size == 20. */
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
- printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+ printf("(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test3);
return False;
}
@@ -3059,21 +3059,21 @@ error_test1:
/* Now test if we can truncate a file opened for readonly. */
- fnum1 = cli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE);
if (fnum1 == -1) {
- printf("(3) open (2) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("(3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test3);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close2 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close2 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
/* Ensure size == 0. */
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
- printf("(3) getatr failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+ printf("(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test3);
return False;
}
@@ -3085,22 +3085,22 @@ error_test1:
}
printf("finished open test 3\n");
error_test3:
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("testing ctemp\n");
- fnum1 = cli_ctemp(cli1->tree, "\\", &tmp_path);
+ fnum1 = smbcli_ctemp(cli1->tree, "\\", &tmp_path);
if (fnum1 == -1) {
- printf("ctemp failed (%s)\n", cli_errstr(cli1->tree));
+ printf("ctemp failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test4);
return False;
}
printf("ctemp gave path %s\n", tmp_path);
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close of temp failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close of temp failed (%s)\n", smbcli_errstr(cli1->tree));
}
- if (NT_STATUS_IS_ERR(cli_unlink(cli1->tree, tmp_path))) {
- printf("unlink of temp failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_unlink(cli1->tree, tmp_path))) {
+ printf("unlink of temp failed (%s)\n", smbcli_errstr(cli1->tree));
}
error_test4:
/* Test the non-io opens... */
@@ -3109,165 +3109,165 @@ error_test4:
return False;
}
- cli_setatr(cli2->tree, fname, 0, 0);
- cli_unlink(cli2->tree, fname);
+ smbcli_setatr(cli2->tree, fname, 0, 0);
+ smbcli_unlink(cli2->tree, fname);
printf("TEST #1 testing 2 non-io opens (no delete)\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 1 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test10);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 == -1) {
- printf("test 1 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test10);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
printf("non-io open test #1 passed.\n");
error_test10:
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("TEST #2 testing 2 non-io opens (first with delete)\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 2 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test20);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 == -1) {
- printf("test 2 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test20);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 1 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("test 1 close 2 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
printf("non-io open test #2 passed.\n");
error_test20:
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("TEST #3 testing 2 non-io opens (second with delete)\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 3 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test30);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 == -1) {
- printf("test 3 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test30);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 3 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("test 3 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
printf("non-io open test #3 passed.\n");
error_test30:
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("TEST #4 testing 2 non-io opens (both with delete)\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 4 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test40);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 != -1) {
- printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test40);
return False;
}
- printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
+ printf("test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation");
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 4 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
printf("non-io open test #4 passed.\n");
error_test40:
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
printf("TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 5 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test50);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 == -1) {
- printf("test 5 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test50);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 5 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("test 5 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
@@ -3275,33 +3275,33 @@ error_test40:
error_test50:
printf("TEST #6 testing 1 non-io open, one io open\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 6 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test60);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 == -1) {
- printf("test 6 open 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test60);
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 6 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli2->tree, fnum2))) {
- printf("test 6 close 2 of %s failed (%s)\n", fname, cli_errstr(cli2->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {
+ printf("test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));
return False;
}
@@ -3309,30 +3309,30 @@ error_test50:
error_test60:
printf("TEST #7 testing 1 non-io open, one io open with delete\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("test 7 open 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test70);
return False;
}
- fnum2 = cli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
+ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, STD_RIGHT_DELETE_ACCESS|SA_RIGHT_FILE_READ_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OPEN_IF, 0, 0);
if (fnum2 != -1) {
- printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, cli_errstr(cli2->tree));
+ printf("test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree));
CHECK_MAX_FAILURES(error_test70);
return False;
}
- printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(cli2->tree), "sharing violation");
+ printf("test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation");
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("test 7 close 1 of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
@@ -3342,11 +3342,11 @@ error_test70:
printf("TEST #8 testing one normal open, followed by lock, followed by open with truncate\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- printf("(8) open (1) of %s failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("(8) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
@@ -3354,14 +3354,14 @@ error_test70:
memset(buf, '\0', 20);
- if (cli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
- printf("(8) write failed (%s)\n", cli_errstr(cli1->tree));
+ if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) {
+ printf("(8) write failed (%s)\n", smbcli_errstr(cli1->tree));
correct = False;
}
/* Ensure size == 20. */
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
- printf("(8) getatr (1) failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+ printf("(8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test80);
return False;
}
@@ -3373,21 +3373,21 @@ error_test70:
}
/* Get an exclusive lock on the open file. */
- if (NT_STATUS_IS_ERR(cli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
- printf("(8) lock1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) {
+ printf("(8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test80);
return False;
}
- fnum2 = cli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
+ fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE);
if (fnum1 == -1) {
- printf("(8) open (2) of %s with truncate failed (%s)\n", fname, cli_errstr(cli1->tree));
+ printf("(8) open (2) of %s with truncate failed (%s)\n", fname, smbcli_errstr(cli1->tree));
return False;
}
/* Ensure size == 0. */
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
- printf("(8) getatr (2) failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) {
+ printf("(8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree));
CHECK_MAX_FAILURES(error_test80);
return False;
}
@@ -3398,13 +3398,13 @@ error_test70:
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("(8) close1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum2))) {
- printf("(8) close1 failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) {
+ printf("(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -3412,7 +3412,7 @@ error_test80:
printf("open test #8 passed.\n");
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
if (!torture_close_connection(cli1)) {
correct = False;
@@ -3483,7 +3483,7 @@ static struct trunc_open_results attr_results[] = {
static BOOL run_openattrtest(int dummy)
{
- struct cli_state *cli1;
+ struct smbcli_state *cli1;
const char *fname = "\\openattr.file";
int fnum1;
BOOL correct = True;
@@ -3498,23 +3498,23 @@ static BOOL run_openattrtest(int dummy)
}
for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32_t); i++) {
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i],
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SA_RIGHT_FILE_WRITE_DATA, open_attrs_table[i],
NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("open %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree));
+ printf("open %d (1) of %s failed (%s)\n", i, fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close %d (1) of %s failed (%s)\n", i, fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close %d (1) of %s failed (%s)\n", i, fname, smbcli_errstr(cli1->tree));
return False;
}
for (j = 0; j < ARRAY_SIZE(open_attrs_table); j++) {
- fnum1 = cli_nt_create_full(cli1->tree, fname, 0,
+ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
SA_RIGHT_FILE_READ_DATA|SA_RIGHT_FILE_WRITE_DATA,
open_attrs_table[j],
NTCREATEX_SHARE_ACCESS_NONE,
@@ -3526,15 +3526,15 @@ static BOOL run_openattrtest(int dummy)
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->tree)), cli_errstr(cli1->tree));
+ fname, NT_STATUS_V(smbcli_nt_error(cli1->tree)), smbcli_errstr(cli1->tree));
correct = False;
CHECK_MAX_FAILURES(error_exit);
}
}
- if (NT_STATUS_V(cli_nt_error(cli1->tree)) != NT_STATUS_V(NT_STATUS_ACCESS_DENIED)) {
+ if (NT_STATUS_V(smbcli_nt_error(cli1->tree)) != NT_STATUS_V(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->tree));
+ smbcli_errstr(cli1->tree));
correct = False;
CHECK_MAX_FAILURES(error_exit);
}
@@ -3545,13 +3545,13 @@ static BOOL run_openattrtest(int dummy)
continue;
}
- if (NT_STATUS_IS_ERR(cli_close(cli1->tree, fnum1))) {
- printf("close %d (2) of %s failed (%s)\n", j, fname, cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
+ printf("close %d (2) of %s failed (%s)\n", j, fname, smbcli_errstr(cli1->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_getatr(cli1->tree, fname, &attr, NULL, NULL))) {
- printf("getatr(2) failed (%s)\n", cli_errstr(cli1->tree));
+ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, &attr, NULL, NULL))) {
+ printf("getatr(2) failed (%s)\n", smbcli_errstr(cli1->tree));
return False;
}
@@ -3580,8 +3580,8 @@ static BOOL run_openattrtest(int dummy)
}
}
error_exit:
- cli_setatr(cli1->tree, fname, 0, 0);
- cli_unlink(cli1->tree, fname);
+ smbcli_setatr(cli1->tree, fname, 0, 0);
+ smbcli_unlink(cli1->tree, fname);
printf("open attr test %s.\n", correct ? "passed" : "failed");
@@ -3602,7 +3602,7 @@ static void list_fn(file_info *finfo, const char *name, void *state)
static BOOL run_dirtest(int dummy)
{
int i;
- struct cli_state *cli;
+ struct smbcli_state *cli;
int fnum;
double t1;
BOOL correct = True;
@@ -3619,20 +3619,20 @@ static BOOL run_dirtest(int dummy)
for (i=0;i<torture_numops;i++) {
char *fname;
asprintf(&fname, "\\%x", (int)random());
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum == -1) {
fprintf(stderr,"Failed to open %s\n", fname);
return False;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
free(fname);
}
t1 = end_timer();
- printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
printf("dirtest core %g seconds\n", end_timer() - t1);
@@ -3640,7 +3640,7 @@ static BOOL run_dirtest(int dummy)
for (i=0;i<torture_numops;i++) {
char *fname;
asprintf(&fname, "\\%x", (int)random());
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
free(fname);
}
@@ -3658,7 +3658,7 @@ static BOOL run_dirtest(int dummy)
*/
BOOL torture_ioctl_test(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
uint16_t device, function;
int fnum;
const char *fname = "\\ioctl.dat";
@@ -3674,11 +3674,11 @@ BOOL torture_ioctl_test(int dummy)
printf("starting ioctl test\n");
- cli_unlink(cli->tree, fname);
+ smbcli_unlink(cli->tree, fname);
- fnum = cli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
- printf("open of %s failed (%s)\n", fname, cli_errstr(cli->tree));
+ printf("open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
return False;
}
@@ -3686,7 +3686,7 @@ BOOL torture_ioctl_test(int dummy)
parms.ioctl.in.fnum = fnum;
parms.ioctl.in.request = IOCTL_QUERY_JOB_INFO;
status = smb_raw_ioctl(cli->tree, mem_ctx, &parms);
- printf("ioctl job info: %s\n", cli_errstr(cli->tree));
+ printf("ioctl job info: %s\n", smbcli_errstr(cli->tree));
for (device=0;device<0x100;device++) {
printf("testing device=0x%x\n", device);
@@ -3714,7 +3714,7 @@ BOOL torture_ioctl_test(int dummy)
*/
BOOL torture_chkpath_test(int dummy)
{
- struct cli_state *cli;
+ struct smbcli_state *cli;
int fnum;
BOOL ret;
@@ -3727,38 +3727,38 @@ BOOL torture_chkpath_test(int dummy)
printf("Testing valid and invalid paths\n");
/* cleanup from an old run */
- cli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
- cli_unlink(cli->tree, "\\chkpath.dir\\*");
- cli_rmdir(cli->tree, "\\chkpath.dir");
+ smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
+ smbcli_unlink(cli->tree, "\\chkpath.dir\\*");
+ smbcli_rmdir(cli->tree, "\\chkpath.dir");
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir"))) {
- printf("mkdir1 failed : %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir"))) {
+ printf("mkdir1 failed : %s\n", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) {
- printf("mkdir2 failed : %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) {
+ printf("mkdir2 failed : %s\n", smbcli_errstr(cli->tree));
return False;
}
- fnum = cli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ fnum = smbcli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
if (fnum == -1) {
- printf("open1 failed (%s)\n", cli_errstr(cli->tree));
+ printf("open1 failed (%s)\n", smbcli_errstr(cli->tree));
return False;
}
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
- if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir"))) {
- printf("chkpath1 failed: %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir"))) {
+ printf("chkpath1 failed: %s\n", smbcli_errstr(cli->tree));
ret = False;
}
- if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) {
- printf("chkpath2 failed: %s\n", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) {
+ printf("chkpath2 failed: %s\n", smbcli_errstr(cli->tree));
ret = False;
}
- if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) {
+ if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) {
ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath,
NT_STATUS_NOT_A_DIRECTORY);
} else {
@@ -3766,7 +3766,7 @@ BOOL torture_chkpath_test(int dummy)
ret = False;
}
- if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) {
+ if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) {
ret = check_error(__LINE__, cli, ERRDOS, ERRbadfile,
NT_STATUS_OBJECT_NAME_NOT_FOUND);
} else {
@@ -3774,7 +3774,7 @@ BOOL torture_chkpath_test(int dummy)
ret = False;
}
- if (NT_STATUS_IS_ERR(cli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) {
+ if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) {
ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath,
NT_STATUS_OBJECT_PATH_NOT_FOUND);
} else {
@@ -3782,9 +3782,9 @@ BOOL torture_chkpath_test(int dummy)
ret = False;
}
- cli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
- cli_unlink(cli->tree, "\\chkpath.dir\\*");
- cli_rmdir(cli->tree, "\\chkpath.dir");
+ smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2");
+ smbcli_unlink(cli->tree, "\\chkpath.dir\\*");
+ smbcli_rmdir(cli->tree, "\\chkpath.dir");
if (!torture_close_connection(cli)) {
return False;
@@ -3796,7 +3796,7 @@ BOOL torture_chkpath_test(int dummy)
static BOOL run_dirtest1(int dummy)
{
int i;
- struct cli_state *cli;
+ struct smbcli_state *cli;
int fnum, num_seen;
BOOL correct = True;
@@ -3806,12 +3806,12 @@ static BOOL run_dirtest1(int dummy)
return False;
}
- if (cli_deltree(cli->tree, "\\LISTDIR") == -1) {
- fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) {
+ fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
return False;
}
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, "\\LISTDIR"))) {
- fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\LISTDIR"))) {
+ fprintf(stderr,"Failed to mkdir %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
return False;
}
@@ -3821,27 +3821,27 @@ static BOOL run_dirtest1(int dummy)
for (i=0;i<torture_entries;i++) {
char *fname;
asprintf(&fname, "\\LISTDIR\\f%d", i);
- fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
+ fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS, FILE_ATTRIBUTE_ARCHIVE,
NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
if (fnum == -1) {
- fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+ fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return False;
}
free(fname);
- cli_close(cli->tree, fnum);
+ smbcli_close(cli->tree, fnum);
}
for (i=0;i<torture_entries;i++) {
char *fname;
asprintf(&fname, "\\LISTDIR\\d%d", i);
- if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, fname))) {
- fprintf(stderr,"Failed to open %s, error=%s\n", fname, cli_errstr(cli->tree));
+ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) {
+ fprintf(stderr,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return False;
}
free(fname);
}
/* Now ensure that doing an old list sees both files and directories. */
- num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+ num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
printf("num_seen = %d\n", num_seen );
/* We should see (torture_entries) each of files & directories + . and .. */
if (num_seen != (2*torture_entries)+2) {
@@ -3854,7 +3854,7 @@ static BOOL run_dirtest1(int dummy)
/* Ensure if we have the "must have" bits we only see the
* relevant entries.
*/
- num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+ num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
printf("num_seen = %d\n", num_seen );
if (num_seen != torture_entries+2) {
correct = False;
@@ -3862,7 +3862,7 @@ static BOOL run_dirtest1(int dummy)
torture_entries+2, num_seen);
}
- num_seen = cli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
+ num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL);
printf("num_seen = %d\n", num_seen );
if (num_seen != torture_entries) {
correct = False;
@@ -3871,15 +3871,15 @@ static BOOL run_dirtest1(int dummy)
}
/* Delete everything. */
- if (cli_deltree(cli->tree, "\\LISTDIR") == -1) {
- fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", cli_errstr(cli->tree));
+ if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) {
+ fprintf(stderr,"Failed to deltree %s, error=%s\n", "\\LISTDIR", smbcli_errstr(cli->tree));
return False;
}
#if 0
- printf("Matched %d\n", cli_list(cli->tree, "a*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli->tree, "b*.*", 0, list_fn, NULL));
- printf("Matched %d\n", cli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "a*.*", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "b*.*", 0, list_fn, NULL));
+ printf("Matched %d\n", smbcli_list(cli->tree, "xyzabc", 0, list_fn, NULL));
#endif
if (!torture_close_connection(cli)) {
@@ -3897,7 +3897,7 @@ static BOOL run_dirtest1(int dummy)
*/
static BOOL run_deny3test(int dummy)
{
- struct cli_state *cli1, *cli2;
+ struct smbcli_state *cli1, *cli2;
int fnum1, fnum2;
const char *fname;
@@ -3914,23 +3914,23 @@ static BOOL run_deny3test(int dummy)
fname = "\\deny_dos1.dat";
- cli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
- fnum2 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
- if (fnum1 != -1) cli_close(cli1->tree, fnum1);
- if (fnum2 != -1) cli_close(cli1->tree, fnum2);
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
+ fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+ fnum2 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+ if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
+ if (fnum2 != -1) smbcli_close(cli1->tree, fnum2);
+ smbcli_unlink(cli1->tree, fname);
printf("fnum1=%d fnum2=%d\n", fnum1, fnum2);
fname = "\\deny_dos2.dat";
- cli_unlink(cli1->tree, fname);
- fnum1 = cli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
- fnum2 = cli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
- if (fnum1 != -1) cli_close(cli1->tree, fnum1);
- if (fnum2 != -1) cli_close(cli2->tree, fnum2);
- cli_unlink(cli1->tree, fname);
+ smbcli_unlink(cli1->tree, fname);
+ fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+ fnum2 = smbcli_open(cli2->tree, fname, O_CREAT|O_TRUNC|O_WRONLY, DENY_DOS);
+ if (fnum1 != -1) smbcli_close(cli1->tree, fnum1);
+ if (fnum2 != -1) smbcli_close(cli2->tree, fnum2);
+ smbcli_unlink(cli1->tree, fname);
printf("fnum1=%d fnum2=%d\n", fnum1, fnum2);
@@ -3968,7 +3968,7 @@ static void sigcont(void)
{
}
-double torture_create_procs(BOOL (*fn)(struct cli_state *, int), BOOL *result)
+double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result)
{
int i, status;
volatile pid_t *child_status;
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 33bfddd722..bb7f6eb4c2 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -39,7 +39,7 @@ double end_timer(void)
/*
create a directory, returning a handle to it
*/
-int create_directory_handle(struct cli_tree *tree, const char *dname)
+int create_directory_handle(struct smbcli_tree *tree, const char *dname)
{
NTSTATUS status;
union smb_open io;
@@ -74,7 +74,7 @@ int create_directory_handle(struct cli_tree *tree, const char *dname)
sometimes we need a fairly complex file to work with, so we can test
all possible attributes.
*/
-int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *fname)
+int create_complex_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname)
{
int fnum;
char buf[7] = "abc";
@@ -83,8 +83,8 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
time_t t = (time(NULL) & ~1);
NTSTATUS status;
- cli_unlink(cli->tree, fname);
- fnum = cli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ smbcli_unlink(cli->tree, fname);
+ fnum = smbcli_nt_create_full(cli->tree, fname, 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
FILE_ATTRIBUTE_NORMAL,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
@@ -93,7 +93,7 @@ int create_complex_file(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *
0, 0);
if (fnum == -1) return -1;
- cli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+ smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
/* setup some EAs */
setfile.generic.level = RAW_SFILEINFO_EA_SET;
@@ -242,7 +242,7 @@ void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo)
/*
dump file infor by name
*/
-void torture_all_info(struct cli_tree *tree, const char *fname)
+void torture_all_info(struct smbcli_tree *tree, const char *fname)
{
TALLOC_CTX *mem_ctx = talloc_init(fname);
union smb_fileinfo finfo;
@@ -304,7 +304,7 @@ BOOL split_username(const char *pair, char **user, char **pass)
/*
set a attribute on a file
*/
-BOOL torture_set_file_attribute(struct cli_tree *tree, const char *fname, uint16_t attrib)
+BOOL torture_set_file_attribute(struct smbcli_tree *tree, const char *fname, uint16_t attrib)
{
union smb_setfileinfo sfinfo;
NTSTATUS status;
@@ -322,7 +322,7 @@ BOOL torture_set_file_attribute(struct cli_tree *tree, const char *fname, uint16
/*
set a file descriptor as sparse
*/
-NTSTATUS torture_set_sparse(struct cli_tree *tree, int fnum)
+NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum)
{
union smb_ioctl nt;
NTSTATUS status;