summaryrefslogtreecommitdiff
path: root/source4/torture/basic
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/basic')
-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
7 files changed, 263 insertions, 263 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;
}