1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00

Merge compile and other fixes from 3.0 to HEAD.

Including smbtorture bugfixes, and a better TCONDEV test.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 0001-01-01 00:00:00 +00:00
parent d20f4bf5d8
commit 52c5806004
6 changed files with 48 additions and 39 deletions

View File

@ -125,7 +125,7 @@ void nb_setup(struct cli_state *cli)
}
void nb_unlink(char *fname)
void nb_unlink(const char *fname)
{
if (!cli_unlink(c, fname)) {
#if NBDEBUG
@ -136,7 +136,7 @@ void nb_unlink(char *fname)
}
void nb_createx(char *fname,
void nb_createx(const char *fname,
unsigned create_options, unsigned create_disposition, int handle)
{
int fd, i;
@ -217,7 +217,7 @@ void nb_close(int handle)
ftable[i].handle = 0;
}
void nb_rmdir(char *fname)
void nb_rmdir(const char *fname)
{
if (!cli_rmdir(c, fname)) {
printf("ERROR: rmdir %s failed (%s)\n",
@ -226,7 +226,7 @@ void nb_rmdir(char *fname)
}
}
void nb_rename(char *old, char *new)
void nb_rename(const char *old, const char *new)
{
if (!cli_rename(c, old, new)) {
printf("ERROR: rename %s %s failed (%s)\n",
@ -236,7 +236,7 @@ void nb_rename(char *old, char *new)
}
void nb_qpathinfo(char *fname)
void nb_qpathinfo(const char *fname)
{
cli_qpathinfo(c, fname, NULL, NULL, NULL, NULL, NULL);
}
@ -260,7 +260,7 @@ static void find_fn(file_info *finfo, const char *name, void *state)
/* noop */
}
void nb_findfirst(char *mask)
void nb_findfirst(const char *mask)
{
cli_list(c, mask, 0, find_fn, NULL);
}
@ -295,7 +295,7 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
free(n);
}
void nb_deltree(char *dname)
void nb_deltree(const char *dname)
{
char *mask;
asprintf(&mask, "%s\\*", dname);

View File

@ -191,7 +191,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 cli_state *cli;
int op, level;
const char *fname = "\\scanner.dat";
int fnum, dnum;
@ -202,26 +202,26 @@ BOOL torture_trans2_scan(int dummy)
return False;
}
fnum = cli_open(&cli, fname, O_RDWR | O_CREAT | O_TRUNC,
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC,
DENY_NONE);
dnum = cli_open(&cli, "\\", O_RDONLY, DENY_NONE);
dnum = cli_open(cli, "\\", O_RDONLY, DENY_NONE);
for (op=OP_MIN; op<=OP_MAX; op++) {
printf("Scanning op=%d\n", op);
for (level = 0; level <= 50; level++) {
scan_trans2(&cli, op, level, fnum, dnum, fname);
scan_trans2(cli, op, level, fnum, dnum, fname);
}
for (level = 0x100; level <= 0x130; level++) {
scan_trans2(&cli, op, level, fnum, dnum, fname);
scan_trans2(cli, op, level, fnum, dnum, fname);
}
for (level = 1000; level < 1050; level++) {
scan_trans2(&cli, op, level, fnum, dnum, fname);
scan_trans2(cli, op, level, fnum, dnum, fname);
}
}
torture_close_connection(&cli);
torture_close_connection(cli);
printf("trans2 scan finished\n");
return True;
@ -393,7 +393,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 cli_state *cli;
int op, level;
const char *fname = "\\scanner.dat";
int fnum, dnum;
@ -404,26 +404,26 @@ BOOL torture_nttrans_scan(int dummy)
return False;
}
fnum = cli_open(&cli, fname, O_RDWR | O_CREAT | O_TRUNC,
fnum = cli_open(cli, fname, O_RDWR | O_CREAT | O_TRUNC,
DENY_NONE);
dnum = cli_open(&cli, "\\", O_RDONLY, DENY_NONE);
dnum = cli_open(cli, "\\", O_RDONLY, DENY_NONE);
for (op=OP_MIN; op<=OP_MAX; op++) {
printf("Scanning op=%d\n", op);
for (level = 0; level <= 50; level++) {
scan_nttrans(&cli, op, level, fnum, dnum, fname);
scan_nttrans(cli, op, level, fnum, dnum, fname);
}
for (level = 0x100; level <= 0x130; level++) {
scan_nttrans(&cli, op, level, fnum, dnum, fname);
scan_nttrans(cli, op, level, fnum, dnum, fname);
}
for (level = 1000; level < 1050; level++) {
scan_nttrans(&cli, op, level, fnum, dnum, fname);
scan_nttrans(cli, op, level, fnum, dnum, fname);
}
}
torture_close_connection(&cli);
torture_close_connection(cli);
printf("nttrans scan finished\n");
return True;

View File

@ -573,12 +573,12 @@ static BOOL run_readwritemulti(int dummy)
cli = current_cli;
cli_sockopt(&cli, sockops);
cli_sockopt(cli, sockops);
printf("run_readwritemulti: fname %s\n", randomfname);
test = rw_torture3(&cli, randomfname);
test = rw_torture3(cli, randomfname);
if (!torture_close_connection(&cli)) {
if (!torture_close_connection(cli)) {
test = False;
}
@ -697,7 +697,7 @@ static BOOL run_netbench(int client)
pstring line;
char cname[20];
FILE *f;
char *params[20];
const char *params[20];
BOOL correct = True;
cli = current_cli;
@ -1066,6 +1066,7 @@ static BOOL run_tcon2_test(int dummy)
static BOOL tcon_devtest(struct cli_state *cli,
const char *myshare, const char *devtype,
const char *return_devtype,
NTSTATUS expected_error)
{
BOOL status;
@ -1076,7 +1077,15 @@ static BOOL tcon_devtest(struct cli_state *cli,
if (NT_STATUS_IS_OK(expected_error)) {
if (status) {
ret = True;
if (strcmp(cli->dev, return_devtype) == 0) {
ret = True;
} else {
printf("tconX to share %s with type %s "
"succeeded but returned the wrong "
"device type (got [%s] but should have got [%s])\n",
myshare, devtype, cli->dev, return_devtype);
ret = False;
}
} else {
printf("tconX to share %s with type %s "
"should have succeeded but failed\n",
@ -1125,34 +1134,34 @@ static BOOL run_tcon_devtype_test(int dummy)
return False;
}
if (!tcon_devtest(cli1, "IPC$", "A:", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, "IPC$", "A:", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
if (!tcon_devtest(cli1, "IPC$", "?????", NT_STATUS_OK))
if (!tcon_devtest(cli1, "IPC$", "?????", "IPC", NT_STATUS_OK))
ret = False;
if (!tcon_devtest(cli1, "IPC$", "LPT:", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, "IPC$", "LPT:", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
if (!tcon_devtest(cli1, "IPC$", "IPC", NT_STATUS_OK))
if (!tcon_devtest(cli1, "IPC$", "IPC", "IPC", NT_STATUS_OK))
ret = False;
if (!tcon_devtest(cli1, "IPC$", "FOOBA", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, "IPC$", "FOOBA", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
if (!tcon_devtest(cli1, share, "A:", NT_STATUS_OK))
if (!tcon_devtest(cli1, share, "A:", "A:", NT_STATUS_OK))
ret = False;
if (!tcon_devtest(cli1, share, "?????", NT_STATUS_OK))
if (!tcon_devtest(cli1, share, "?????", "A:", NT_STATUS_OK))
ret = False;
if (!tcon_devtest(cli1, share, "LPT:", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, share, "LPT:", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
if (!tcon_devtest(cli1, share, "IPC", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, share, "IPC", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
if (!tcon_devtest(cli1, share, "FOOBA", NT_STATUS_BAD_DEVICE_TYPE))
if (!tcon_devtest(cli1, share, "FOOBA", NULL, NT_STATUS_BAD_DEVICE_TYPE))
ret = False;
cli_shutdown(cli1);

View File

@ -464,7 +464,7 @@ static BOOL check_auth_crap(void)
and valid authentication types
*/
static const DATA_BLOB get_challenge(void)
static DATA_BLOB get_challenge(void)
{
static DATA_BLOB chal;
if (opt_challenge.length)

View File

@ -674,7 +674,7 @@ int main(int argc, char **argv)
poptContext pc;
int opt;
struct poptOption wbinfo_options[] = {
static struct poptOption wbinfo_options[] = {
{ "timeout", 't', POPT_ARG_INT, &timeout, 't',
"Set timeout value in seconds", "TIMEOUT" },

View File

@ -393,7 +393,7 @@ static struct cli_state *connect_one(const char *share)
pstring set_str = {0};
enum SMB_QUOTA_TYPE qtype;
int cmd = 0;
BOOL test_args = False;
static BOOL test_args = False;
struct cli_state *cli;
BOOL fix_user = False;
SMB_NTQUOTA_STRUCT qt;