From ffb63e4f8ec2b7390cbb00bca74a9bedb8399a91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Jun 2001 02:02:19 +0000 Subject: moved all our torture code to a separate directory (This used to be commit dd12c47645e2d0e832bc555492a6a8725a4495ee) --- source3/torture/locktest.c | 567 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 567 insertions(+) create mode 100644 source3/torture/locktest.c (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c new file mode 100644 index 0000000000..80dbba1e37 --- /dev/null +++ b/source3/torture/locktest.c @@ -0,0 +1,567 @@ +/* + Unix SMB/Netbios implementation. + Version 2.0 + randomised byte range lock tester + Copyright (C) Andrew Tridgell 1999 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define NO_SYSLOG + +#include "includes.h" + +static fstring password; +static fstring username; +static int got_pass; +static int numops = 1000; +static BOOL showall; +static BOOL analyze; +static BOOL hide_unlock_fails; +static BOOL use_oplocks; + +#define FILENAME "\\locktest.dat" +#define LOCKRANGE 1000 +#define LOCKBASE 0; + +/* +#define LOCKBASE (0x40000000 - 50) +*/ + +#define READ_PCT 50 +#define LOCK_PCT 35 +#define UNLOCK_PCT 55 +#define RANGE_MULTIPLE 1 +#define NSERVERS 2 +#define NCONNECTIONS 2 +#define NFILES 2 +#define LOCK_TIMEOUT 0 + +#define NASTY_POSIX_LOCK_HACK 0 + + +struct record { + char r1, r2; + char conn, f; + SMB_BIG_UINT start, len; + char needed; +}; + +static struct record preset[] = { +#if 0 +{36, 5, 0, 0, 0, 8, 1}, +{ 2, 6, 0, 1, 0, 1, 1}, +{53, 92, 0, 0, 0, 0, 1}, +{99, 11, 0, 0, 7, 1, 1}, +#endif +}; + +static struct record *recorded; + +static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid, + enum brl_type lock_type, + br_off start, br_off size) +{ +#if NASTY_POSIX_LOCK_HACK + { + pstring cmd; + static SMB_INO_T lastino; + + if (lastino != ino) { + slprintf(cmd, sizeof(cmd), + "egrep POSIX.*%u /proc/locks", (int)ino); + system(cmd); + } + lastino = ino; + } +#endif + + printf("%6d %05x:%05x %s %.0f:%.0f(%.0f)\n", + (int)pid, (int)dev, (int)ino, + lock_type==READ_LOCK?"R":"W", + (double)start, (double)start+size-1,(double)size); + +} + + +static void show_locks(void) +{ + brl_forall(print_brl); + /* system("cat /proc/locks"); */ +} + + +/***************************************************** +return a connection to a server +*******************************************************/ +struct cli_state *connect_one(char *share) +{ + struct cli_state *c; + struct nmb_name called, calling; + char *server_n; + fstring server; + struct in_addr ip; + extern struct in_addr ipzero; + fstring myname; + static int count; + + fstrcpy(server,share+2); + share = strchr(server,'\\'); + if (!share) return NULL; + *share = 0; + share++; + + server_n = server; + + ip = ipzero; + + slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); + + make_nmb_name(&calling, myname, 0x0); + make_nmb_name(&called , server, 0x20); + + again: + ip = ipzero; + + /* have to open a new connection */ + if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) || + !cli_connect(c, server_n, &ip)) { + DEBUG(0,("Connection to %s failed\n", server_n)); + return NULL; + } + + if (!cli_session_request(c, &calling, &called)) { + DEBUG(0,("session request to %s failed\n", called.name)); + cli_shutdown(c); + if (strcmp(called.name, "*SMBSERVER")) { + make_nmb_name(&called , "*SMBSERVER", 0x20); + goto again; + } + return NULL; + } + + DEBUG(4,(" session request ok\n")); + + if (!cli_negprot(c)) { + DEBUG(0,("protocol negotiation failed\n")); + cli_shutdown(c); + return NULL; + } + + if (!got_pass) { + char *pass = getpass("Password: "); + if (pass) { + pstrcpy(password, pass); + } + } + + if (!cli_session_setup(c, username, + password, strlen(password), + password, strlen(password), + lp_workgroup())) { + DEBUG(0,("session setup failed: %s\n", cli_errstr(c))); + return NULL; + } + + /* + * These next two lines are needed to emulate + * old client behaviour for people who have + * scripts based on client output. + * QUESTION ? Do we want to have a 'client compatibility + * mode to turn these on/off ? JRA. + */ + + if (*c->server_domain || *c->server_os || *c->server_type) + DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n", + c->server_domain,c->server_os,c->server_type)); + + DEBUG(4,(" session setup ok\n")); + + if (!cli_send_tconX(c, share, "?????", + password, strlen(password)+1)) { + DEBUG(0,("tree connect failed: %s\n", cli_errstr(c))); + cli_shutdown(c); + return NULL; + } + + DEBUG(4,(" tconx ok\n")); + + c->use_oplocks = use_oplocks; + + return c; +} + + +static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES], + char *share[NSERVERS]) +{ + int server, conn, f; + + for (server=0;serverconn; + unsigned f = rec->f; + SMB_BIG_UINT start = rec->start; + SMB_BIG_UINT len = rec->len; + unsigned r1 = rec->r1; + unsigned r2 = rec->r2; + unsigned op; + int server; + BOOL ret[NSERVERS]; + + if (r1 < READ_PCT) { + op = READ_LOCK; + } else { + op = WRITE_LOCK; + } + + if (r2 < LOCK_PCT) { + /* set a lock */ + for (server=0;server %u:%u\n", + conn, f, + (double)start, (double)start+len-1, (double)len, + op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", + ret[0], ret[1]); + } + if (showall || ret[0] != ret[1]) show_locks(); + if (ret[0] != ret[1]) return False; + } else if (r2 < LOCK_PCT+UNLOCK_PCT) { + /* unset a lock */ + for (server=0;server %u:%u\n", + conn, f, + (double)start, (double)start+len-1, (double)len, + ret[0], ret[1]); + } + if (showall || ret[0] != ret[1]) show_locks(); + if (!hide_unlock_fails && ret[0] != ret[1]) return False; + } else { + /* reopen the file */ + for (server=0;server Date: Tue, 19 Jun 2001 02:06:12 +0000 Subject: added a torture target for building all torture progs. Fixed a typo in locktest (This used to be commit fd0d729ce0d9a057e867001c2ea52c8599713b28) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 80dbba1e37..cee18624a4 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -34,7 +34,7 @@ static BOOL use_oplocks; #define FILENAME "\\locktest.dat" #define LOCKRANGE 1000 -#define LOCKBASE 0; +#define LOCKBASE 0 /* #define LOCKBASE (0x40000000 - 50) -- cgit From 983d841e369eeecf0e2a501dfb9b97dfc367fb8d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 3 Jul 2001 04:29:50 +0000 Subject: See if we can stick to slightly valid C.. (With thanks to tpot) Andrew Bartlett (This used to be commit e77cfe1379d92d2be4e2895454e14d11311a913d) --- source3/torture/locktest.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index cee18624a4..ef6c9a978a 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -59,14 +59,16 @@ struct record { char needed; }; +#define PRESETS 0 + +#if PRESETS static struct record preset[] = { -#if 0 {36, 5, 0, 0, 0, 8, 1}, { 2, 6, 0, 1, 0, 1, 1}, {53, 92, 0, 0, 0, 0, 1}, {99, 11, 0, 0, 7, 1, 1}, -#endif }; +#endif static struct record *recorded; @@ -378,9 +380,11 @@ static void test_locks(char *share[NSERVERS]) recorded = (struct record *)malloc(sizeof(*recorded) * numops); for (n=0; n Date: Wed, 4 Jul 2001 07:15:53 +0000 Subject: The big character set handling changeover! This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a) --- source3/torture/locktest.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ef6c9a978a..2eaa6057c6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -510,8 +510,6 @@ static void usage(void) argv += NSERVERS; TimeInit(); - charset_initialise(); - codepage_initialise(lp_client_code_page()); lp_load(servicesf,True,False,False); load_interfaces(); -- cgit From 527e824293ee934ca5da0ef5424efe5ab7757248 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:36:09 +0000 Subject: strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 2eaa6057c6..f7f7c580aa 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -120,7 +120,7 @@ struct cli_state *connect_one(char *share) static int count; fstrcpy(server,share+2); - share = strchr(server,'\\'); + share = strchr_m(server,'\\'); if (!share) return NULL; *share = 0; share++; @@ -524,7 +524,7 @@ static void usage(void) switch (opt) { case 'U': pstrcpy(username,optarg); - p = strchr(username,'%'); + p = strchr_m(username,'%'); if (p) { *p = 0; pstrcpy(password, p+1); -- cgit From 98e407a02169f65c5518472f9e1edf7ec79c3a8c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Aug 2001 04:57:13 +0000 Subject: allow for 0 range locks in locktest (This used to be commit c3b2d959a7461cf6f9574716c8a7b915c078b311) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index f7f7c580aa..54cf0dd351 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -388,7 +388,7 @@ static void test_locks(char *share[NSERVERS]) recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1)); - recorded[n].len = 1 + + recorded[n].len = random() % (LOCKRANGE-(recorded[n].start-LOCKBASE)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; -- cgit From b34d17e49811df341054038ebb01734c9c83623c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Aug 2001 19:34:11 +0000 Subject: tests for 0 length locks (This used to be commit 8fbd1d0f978a349ec4fcc0d34fca55314d3dec31) --- source3/torture/locktest.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 54cf0dd351..4c62b8dafc 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -33,8 +33,9 @@ static BOOL hide_unlock_fails; static BOOL use_oplocks; #define FILENAME "\\locktest.dat" -#define LOCKRANGE 1000 +#define LOCKRANGE 5 #define LOCKBASE 0 +#define MINLENGTH 0 /* #define LOCKBASE (0x40000000 - 50) @@ -260,9 +261,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], start, len, LOCK_TIMEOUT, op); } if (showall || ret[0] != ret[1]) { - printf("lock conn=%u f=%u range=%.0f:%.0f(%.0f) op=%s -> %u:%u\n", + printf("lock conn=%u f=%u range=%.0f(%.0f) op=%s -> %u:%u\n", conn, f, - (double)start, (double)start+len-1, (double)len, + (double)start, (double)len, op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", ret[0], ret[1]); } @@ -276,9 +277,9 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], start, len); } if (showall || (!hide_unlock_fails && (ret[0] != ret[1]))) { - printf("unlock conn=%u f=%u range=%.0f:%.0f(%.0f) -> %u:%u\n", + printf("unlock conn=%u f=%u range=%.0f(%.0f) -> %u:%u\n", conn, f, - (double)start, (double)start+len-1, (double)len, + (double)start, (double)len, ret[0], ret[1]); } if (showall || ret[0] != ret[1]) show_locks(); @@ -372,7 +373,7 @@ static void test_locks(char *share[NSERVERS]) { struct cli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; - int n, i, n1; + int n, i, n1, skip; ZERO_STRUCT(fnum); ZERO_STRUCT(cli); @@ -388,7 +389,7 @@ static void test_locks(char *share[NSERVERS]) recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1)); - recorded[n].len = + recorded[n].len = MINLENGTH + random() % (LOCKRANGE-(recorded[n].start-LOCKBASE)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; @@ -407,6 +408,8 @@ static void test_locks(char *share[NSERVERS]) if (n == numops || !analyze) return; n++; + skip = n/2; + while (1) { n1 = n; @@ -414,26 +417,36 @@ static void test_locks(char *share[NSERVERS]) reconnect(cli, fnum, share); open_files(cli, fnum); - for (i=0;i 1) { + skip = skip/2; + printf("skip=%d\n", skip); + continue; + } + if (n1 == n) break; } -- cgit From 464237cdb8d4f4c4c93d9cf24f38f2720ea99b9c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 24 Aug 2001 20:11:09 +0000 Subject: fixed handling of 139/445 in clients (This used to be commit 22b372f8a7996a19bebb8cdb411df999cffa32a4) --- source3/torture/locktest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 4c62b8dafc..82eee773f2 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -139,8 +139,7 @@ struct cli_state *connect_one(char *share) ip = ipzero; /* have to open a new connection */ - if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) || - !cli_connect(c, server_n, &ip)) { + if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { DEBUG(0,("Connection to %s failed\n", server_n)); return NULL; } -- cgit From e8e98c9ea0690e3acf1126b50882e59e1056c7b3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Aug 2001 08:19:43 +0000 Subject: converted smbd to use NTSTATUS by default major changes include: - added NSTATUS type - added automatic mapping between dos and nt error codes - changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT() these calls auto-translate to the client error code system - got rid of the cached error code and the writebmpx code We eventually will need to also: - get rid of BOOL, so we don't lose error info - replace all ERROR_DOS() calls with ERROR_NT() calls but that is too much for one night (This used to be commit 83d9896c1ea8be796192b51a4678c2a3b87f7518) --- source3/torture/locktest.c | 102 +++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 27 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 82eee773f2..0339576b11 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -37,13 +37,15 @@ static BOOL use_oplocks; #define LOCKBASE 0 #define MINLENGTH 0 +#define ZERO_ZERO 1 + /* #define LOCKBASE (0x40000000 - 50) */ #define READ_PCT 50 -#define LOCK_PCT 35 -#define UNLOCK_PCT 55 +#define LOCK_PCT 45 +#define UNLOCK_PCT 70 #define RANGE_MULTIPLE 1 #define NSERVERS 2 #define NCONNECTIONS 2 @@ -52,9 +54,11 @@ static BOOL use_oplocks; #define NASTY_POSIX_LOCK_HACK 0 +enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN}; struct record { - char r1, r2; + enum lock_op lock_op; + int lock_type; char conn, f; SMB_BIG_UINT start, len; char needed; @@ -64,10 +68,37 @@ struct record { #if PRESETS static struct record preset[] = { -{36, 5, 0, 0, 0, 8, 1}, -{ 2, 6, 0, 1, 0, 1, 1}, -{53, 92, 0, 0, 0, 0, 1}, -{99, 11, 0, 0, 7, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 3, 0, 1}, +{OP_UNLOCK, 0 , 0, 0, 2, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + +{OP_LOCK, READ_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, READ_LOCK, 0, 0, 1, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + +{OP_LOCK, READ_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 3, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + +{OP_LOCK, READ_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 1, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + +{OP_LOCK, WRITE_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, READ_LOCK, 0, 0, 1, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + +{OP_LOCK, WRITE_LOCK, 0, 0, 2, 0, 1}, +{OP_LOCK, READ_LOCK, 0, 0, 3, 1, 1}, +{OP_LOCK, WRITE_LOCK, 0, 0, 0, 0, 1}, +{OP_REOPEN, 0, 0, 0, 0, 0, 1}, + }; #endif @@ -240,19 +271,12 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], unsigned f = rec->f; SMB_BIG_UINT start = rec->start; SMB_BIG_UINT len = rec->len; - unsigned r1 = rec->r1; - unsigned r2 = rec->r2; - unsigned op; + unsigned op = rec->lock_type; int server; BOOL ret[NSERVERS]; - if (r1 < READ_PCT) { - op = READ_LOCK; - } else { - op = WRITE_LOCK; - } - - if (r2 < LOCK_PCT) { + switch (rec->lock_op) { + case OP_LOCK: /* set a lock */ for (server=0;server Date: Mon, 10 Sep 2001 11:08:57 +0000 Subject: replaced stdio in many parts of samba with a XFILE. XFILE is a cut-down replacemnt of stdio that doesn't suffer from the 8-bit filedescriptor limit that we hit with nasty consequences on some systems I would eventually prefer us to have a configure test to see if we need to replace stdio, but for now this code needs to be tested widely so I'm enabling it by default. (This used to be commit 1af8bf34f1caa3e7ec312d8109c07d32a945a448) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 0339576b11..bcae4fa924 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -545,7 +545,7 @@ static void usage(void) char *share[NSERVERS]; extern char *optarg; extern int optind; - extern FILE *dbf; + extern XFILE *dbf; int opt; char *p; int seed, server; @@ -553,7 +553,7 @@ static void usage(void) setlinebuf(stdout); - dbf = stderr; + dbf = x_stderr; if (argc < 3 || argv[1][0] == '-') { usage(); -- cgit From b12a4dd9b655485420d5c67dd143d8f49ac28a40 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 10 Sep 2001 12:14:18 +0000 Subject: declare dbf in one spot (This used to be commit f41c3bb80f1e498a9d27f6e236b0ff3a742764c9) --- source3/torture/locktest.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index bcae4fa924..5ace2622ac 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -545,7 +545,6 @@ static void usage(void) char *share[NSERVERS]; extern char *optarg; extern int optind; - extern XFILE *dbf; int opt; char *p; int seed, server; -- cgit From f7f020021051ae143d52925aad4c8729ba4da411 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 16 Sep 2001 08:24:44 +0000 Subject: Fix (I hope) for a number of little compile warnings found by the IRIX compilers on the build farm. Andrew Bartlett (This used to be commit 0ff0a91a6baf7cf6b3ca59a2b4067cc07e3f2f88) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 5ace2622ac..b107afc895 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -58,7 +58,7 @@ enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN}; struct record { enum lock_op lock_op; - int lock_type; + enum brl_type lock_type; char conn, f; SMB_BIG_UINT start, len; char needed; @@ -271,7 +271,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], unsigned f = rec->f; SMB_BIG_UINT start = rec->start; SMB_BIG_UINT len = rec->len; - unsigned op = rec->lock_type; + enum brl_type op = rec->lock_type; int server; BOOL ret[NSERVERS]; -- cgit From 2d6a3079b805a57f5618c97fff2adda77de934f4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Sep 2001 11:37:57 +0000 Subject: move to SAFE_FREE() (This used to be commit fc71962409e11509a60fb2be6741c32970865881) --- source3/torture/locktest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index b107afc895..b70b445c08 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -250,8 +250,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS } cli_ulogoff(cli[server][conn]); cli_shutdown(cli[server][conn]); - free(cli[server][conn]); - cli[server][conn] = NULL; + SAFE_FREE(cli[server][conn]); } cli[server][conn] = connect_one(share[server]); if (!cli[server][conn]) { -- cgit From f741f656737f4ec46cd318e986b6bf412ed309d2 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 19 Nov 2001 02:49:53 +0000 Subject: Store some path names in global variables initialized to configure default, rather than in preprocessor macros. (This used to be commit 79ec88f0da40faebe1e587f1b3e87b5f2b184f58) --- source3/torture/locktest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index b70b445c08..5d48a1f0fa 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -547,7 +547,6 @@ static void usage(void) int opt; char *p; int seed, server; - static pstring servicesf = CONFIGFILE; setlinebuf(stdout); @@ -570,7 +569,7 @@ static void usage(void) TimeInit(); - lp_load(servicesf,True,False,False); + lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); if (getenv("USER")) { -- cgit From e1eb073fa42fc06ec4015f9b7e8b377361d720d0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 20 Nov 2001 08:48:46 +0000 Subject: fix locktest default parameters (This used to be commit f6a4b00aab9ca01d8dfed33252f3d5c5349d13b0) --- source3/torture/locktest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 5d48a1f0fa..26c0dcbd29 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -33,11 +33,11 @@ static BOOL hide_unlock_fails; static BOOL use_oplocks; #define FILENAME "\\locktest.dat" -#define LOCKRANGE 5 +#define LOCKRANGE 100 #define LOCKBASE 0 #define MINLENGTH 0 -#define ZERO_ZERO 1 +#define ZERO_ZERO 0 /* #define LOCKBASE (0x40000000 - 50) @@ -532,6 +532,7 @@ static void usage(void) -o numops\n\ -u hide unlock fails\n\ -a (show all ops)\n\ + -A analyse for minimal ops\n\ -O use oplocks\n\ "); } -- cgit From 79b34d1b11e685d068b9c0ac9a0ec06eaa263d82 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 23 Nov 2001 00:52:29 +0000 Subject: Removed TimeInit() call from every client program (except for one place in smbd/process.c where the timezone is reinitialised. Was replaced with check for a static is_initialised boolean. (This used to be commit 8fc772c9e5770cd3a8857670214dcff033ebae32) --- source3/torture/locktest.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 26c0dcbd29..ccff2b2624 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -568,8 +568,6 @@ static void usage(void) argc -= NSERVERS; argv += NSERVERS; - TimeInit(); - lp_load(dyn_CONFIGFILE,True,False,False); load_interfaces(); -- cgit From 585d0efbc6428e5876d354fee49c241c1bad809d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 26 Nov 2001 03:11:44 +0000 Subject: Got medieval on another pointless extern. Removed extern struct ipzero and replaced with two functions: void zero_ip(struct in_adder *ip); BOOL is_zero_ip(struct in_addr ip); (This used to be commit 778f5f77a66cda76348a7c6f64cd63afe2bfe077) --- source3/torture/locktest.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ccff2b2624..8606c9e38a 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -147,7 +147,6 @@ struct cli_state *connect_one(char *share) char *server_n; fstring server; struct in_addr ip; - extern struct in_addr ipzero; fstring myname; static int count; @@ -159,7 +158,7 @@ struct cli_state *connect_one(char *share) server_n = server; - ip = ipzero; + zero_ip(&ip); slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); @@ -167,7 +166,7 @@ struct cli_state *connect_one(char *share) make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { -- cgit From eec9e8a052407611df223fec982588e7a2bd7f49 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 28 Nov 2001 03:56:30 +0000 Subject: fix a bunch of places where we can double-free a cli structure (This used to be commit e2ba2383c9f679c076749a8f4fccefc3559e37ec) --- source3/torture/locktest.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 8606c9e38a..4e5d630f30 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -249,7 +249,6 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS } cli_ulogoff(cli[server][conn]); cli_shutdown(cli[server][conn]); - SAFE_FREE(cli[server][conn]); } cli[server][conn] = connect_one(share[server]); if (!cli[server][conn]) { -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/torture/locktest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 4e5d630f30..0ed8c5f904 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -1,6 +1,5 @@ /* - Unix SMB/Netbios implementation. - Version 2.0 + Unix SMB/CIFS implementation. randomised byte range lock tester Copyright (C) Andrew Tridgell 1999 -- cgit From c40d0d5783300ee8dfcff1382becf8f6c0f4ff25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Mar 2002 00:24:24 +0000 Subject: added -k options for kerberos to smbtorture and locktest (This used to be commit 46b89bc9979229abc6e9f2f8c585a22dd4f22902) --- source3/torture/locktest.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 0ed8c5f904..ad30537e69 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -25,6 +25,7 @@ static fstring password; static fstring username; static int got_pass; +static BOOL use_kerberos; static int numops = 1000; static BOOL showall; static BOOL analyze; @@ -173,6 +174,8 @@ struct cli_state *connect_one(char *share) return NULL; } + c->use_kerberos = use_kerberos; + if (!cli_session_request(c, &calling, &called)) { DEBUG(0,("session request to %s failed\n", called.name)); cli_shutdown(c); @@ -525,6 +528,7 @@ static void usage(void) locktest //server1/share1 //server2/share2 [options..]\n\ options:\n\ -U user%%pass\n\ + -k use kerberos\n\ -s seed\n\ -o numops\n\ -u hide unlock fails\n\ @@ -574,8 +578,17 @@ static void usage(void) seed = time(NULL); - while ((opt = getopt(argc, argv, "U:s:ho:aAW:O")) != EOF) { + while ((opt = getopt(argc, argv, "U:s:ho:aAW:Ok")) != EOF) { switch (opt) { + case 'k': +#ifdef HAVE_KRB5 + use_kerberos = True; + got_pass = True; +#else + d_printf("No kerberos support compiled in\n"); + exit(1); +#endif + break; case 'U': pstrcpy(username,optarg); p = strchr_m(username,'%'); -- cgit From 1315c8c4cf1b13926d8d4cef76fdd98654683ac9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Mar 2002 00:35:28 +0000 Subject: allow setting of lock range and base in locktest (This used to be commit 97993630add4e8965f0395f92d34b0e8a6d9b875) --- source3/torture/locktest.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ad30537e69..2f7c4a9c05 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -31,17 +31,13 @@ static BOOL showall; static BOOL analyze; static BOOL hide_unlock_fails; static BOOL use_oplocks; +static unsigned lock_range = 100; +static unsigned lock_base = 0; #define FILENAME "\\locktest.dat" -#define LOCKRANGE 100 -#define LOCKBASE 0 #define MINLENGTH 0 -#define ZERO_ZERO 0 - -/* -#define LOCKBASE (0x40000000 - 50) -*/ +#define ZERO_ZERO 1 #define READ_PCT 50 #define LOCK_PCT 45 @@ -416,9 +412,9 @@ static void test_locks(char *share[NSERVERS]) #endif recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; - recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1)); + recorded[n].start = lock_base + ((unsigned)random() % (lock_range-1)); recorded[n].len = MINLENGTH + - random() % (LOCKRANGE-(recorded[n].start-LOCKBASE)); + random() % (lock_range-(recorded[n].start-lock_base)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; r1 = random() % 100; @@ -535,6 +531,8 @@ static void usage(void) -a (show all ops)\n\ -A analyse for minimal ops\n\ -O use oplocks\n\ + -R range set lock range\n\ + -B base set lock base\n\ "); } @@ -578,7 +576,7 @@ static void usage(void) seed = time(NULL); - while ((opt = getopt(argc, argv, "U:s:ho:aAW:Ok")) != EOF) { + while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:")) != EOF) { switch (opt) { case 'k': #ifdef HAVE_KRB5 @@ -598,6 +596,12 @@ static void usage(void) got_pass = 1; } break; + case 'R': + lock_range = strtol(optarg, NULL, 0); + break; + case 'B': + lock_base = strtol(optarg, NULL, 0); + break; case 's': seed = atoi(optarg); break; -- cgit From 7f35a045fc8fc289830cf27180ca5b833cbb3c9b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 5 Mar 2002 19:51:37 +0000 Subject: added -M option for minimum lock size (This used to be commit 6acd98cbb92ec5c78686d23d2e05c1c98b5127fe) --- source3/torture/locktest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 2f7c4a9c05..47be83e97f 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -33,11 +33,11 @@ static BOOL hide_unlock_fails; static BOOL use_oplocks; static unsigned lock_range = 100; static unsigned lock_base = 0; +static unsigned min_length = 0; #define FILENAME "\\locktest.dat" -#define MINLENGTH 0 -#define ZERO_ZERO 1 +#define ZERO_ZERO 0 #define READ_PCT 50 #define LOCK_PCT 45 @@ -413,7 +413,7 @@ static void test_locks(char *share[NSERVERS]) recorded[n].conn = random() % NCONNECTIONS; recorded[n].f = random() % NFILES; recorded[n].start = lock_base + ((unsigned)random() % (lock_range-1)); - recorded[n].len = MINLENGTH + + recorded[n].len = min_length + random() % (lock_range-(recorded[n].start-lock_base)); recorded[n].start *= RANGE_MULTIPLE; recorded[n].len *= RANGE_MULTIPLE; @@ -533,6 +533,7 @@ static void usage(void) -O use oplocks\n\ -R range set lock range\n\ -B base set lock base\n\ + -M min set min lock length\n\ "); } @@ -576,7 +577,7 @@ static void usage(void) seed = time(NULL); - while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:")) != EOF) { + while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:M:")) != EOF) { switch (opt) { case 'k': #ifdef HAVE_KRB5 @@ -602,6 +603,9 @@ static void usage(void) case 'B': lock_base = strtol(optarg, NULL, 0); break; + case 'M': + min_length = strtol(optarg, NULL, 0); + break; case 's': seed = atoi(optarg); break; -- cgit From e450ba6639accd00b112e1ce9089ef4b487d8b1c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Mar 2002 23:17:47 +0000 Subject: added -E and -Z options, and allow for the 2 servers to have different usernames/passwords (This used to be commit 0ae4ba18e578d35206628fa29203c8becbbdc5cd) --- source3/torture/locktest.c | 96 ++++++++++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 33 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 47be83e97f..08a9e74269 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -22,8 +22,8 @@ #include "includes.h" -static fstring password; -static fstring username; +static fstring password[2]; +static fstring username[2]; static int got_pass; static BOOL use_kerberos; static int numops = 1000; @@ -34,11 +34,11 @@ static BOOL use_oplocks; static unsigned lock_range = 100; static unsigned lock_base = 0; static unsigned min_length = 0; +static BOOL exact_error_codes; +static BOOL zero_zero; #define FILENAME "\\locktest.dat" -#define ZERO_ZERO 0 - #define READ_PCT 50 #define LOCK_PCT 45 #define UNLOCK_PCT 70 @@ -136,7 +136,7 @@ static void show_locks(void) /***************************************************** return a connection to a server *******************************************************/ -struct cli_state *connect_one(char *share) +struct cli_state *connect_one(char *share, int snum) { struct cli_state *c; struct nmb_name called, calling; @@ -193,13 +193,19 @@ struct cli_state *connect_one(char *share) if (!got_pass) { char *pass = getpass("Password: "); if (pass) { - pstrcpy(password, pass); + pstrcpy(password[0], pass); + pstrcpy(password[1], pass); } } - if (!cli_session_setup(c, username, - password, strlen(password), - password, strlen(password), + if (got_pass == 1) { + pstrcpy(password[1], password[0]); + pstrcpy(username[1], username[0]); + } + + if (!cli_session_setup(c, username[snum], + password[snum], strlen(password[snum]), + password[snum], strlen(password[snum]), lp_workgroup())) { DEBUG(0,("session setup failed: %s\n", cli_errstr(c))); return NULL; @@ -220,7 +226,7 @@ struct cli_state *connect_one(char *share) DEBUG(4,(" session setup ok\n")); if (!cli_send_tconX(c, share, "?????", - password, strlen(password)+1)) { + password[snum], strlen(password[snum])+1)) { DEBUG(0,("tree connect failed: %s\n", cli_errstr(c))); cli_shutdown(c); return NULL; @@ -243,12 +249,15 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS for (conn=0;connlock_type; int server; BOOL ret[NSERVERS]; + NTSTATUS status[NSERVERS]; switch (rec->lock_op) { case OP_LOCK: @@ -277,16 +287,22 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], ret[server] = cli_lock64(cli[server][conn], fnum[server][conn][f], start, len, LOCK_TIMEOUT, op); + status[server] = cli_nt_error(cli[server][conn]); + if (!exact_error_codes && + NT_STATUS_EQUAL(status[server], + NT_STATUS_FILE_LOCK_CONFLICT)) { + status[server] = NT_STATUS_LOCK_NOT_GRANTED; + } } - if (showall || ret[0] != ret[1]) { - printf("lock conn=%u f=%u range=%.0f(%.0f) op=%s -> %u:%u\n", + if (showall || !NT_STATUS_EQUAL(status[0],status[1])) { + printf("lock conn=%u f=%u range=%.0f(%.0f) op=%s -> %s:%s\n", conn, f, (double)start, (double)len, op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", - ret[0], ret[1]); + get_nt_error_msg(status[0]), get_nt_error_msg(status[1])); } - if (showall || ret[0] != ret[1]) show_locks(); - if (ret[0] != ret[1]) return False; + if (showall || !NT_STATUS_EQUAL(status[0],status[1])) show_locks(); + if (!NT_STATUS_EQUAL(status[0],status[1])) return False; break; case OP_UNLOCK: @@ -295,21 +311,25 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], ret[server] = cli_unlock64(cli[server][conn], fnum[server][conn][f], start, len); + status[server] = cli_nt_error(cli[server][conn]); } - if (showall || (!hide_unlock_fails && (ret[0] != ret[1]))) { - printf("unlock conn=%u f=%u range=%.0f(%.0f) -> %u:%u\n", + if (showall || + (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1]))) { + printf("unlock conn=%u f=%u range=%.0f(%.0f) -> %s:%s\n", conn, f, (double)start, (double)len, - ret[0], ret[1]); + get_nt_error_msg(status[0]), get_nt_error_msg(status[1])); } - if (showall || ret[0] != ret[1]) show_locks(); - if (!hide_unlock_fails && ret[0] != ret[1]) return False; + if (showall || !NT_STATUS_EQUAL(status[0],status[1])) show_locks(); + if (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1])) + return False; break; case OP_REOPEN: /* reopen the file */ for (server=0;server Date: Sun, 17 Mar 2002 04:36:35 +0000 Subject: Renamed get_nt_error_msg() to nt_errstr(). (This used to be commit 1f007d3ed41c1b71a89fa6be7d173e67e927c302) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 08a9e74269..c34b4c1ad2 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -299,7 +299,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], conn, f, (double)start, (double)len, op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", - get_nt_error_msg(status[0]), get_nt_error_msg(status[1])); + nt_errstr(status[0]), nt_errstr(status[1])); } if (showall || !NT_STATUS_EQUAL(status[0],status[1])) show_locks(); if (!NT_STATUS_EQUAL(status[0],status[1])) return False; @@ -318,7 +318,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], printf("unlock conn=%u f=%u range=%.0f(%.0f) -> %s:%s\n", conn, f, (double)start, (double)len, - get_nt_error_msg(status[0]), get_nt_error_msg(status[1])); + nt_errstr(status[0]), nt_errstr(status[1])); } if (showall || !NT_STATUS_EQUAL(status[0],status[1])) show_locks(); if (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1])) -- cgit From 287d49bb5da3a0eece5501910aef30328f63e30a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Aug 2002 15:04:57 +0000 Subject: Sync 3.0 branch with HEAD (This used to be commit d3599b446ed1c8ccd7c9e161ecfa5d52d6066c22) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index c34b4c1ad2..a62f7af1ad 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -136,7 +136,7 @@ static void show_locks(void) /***************************************************** return a connection to a server *******************************************************/ -struct cli_state *connect_one(char *share, int snum) +static struct cli_state *connect_one(char *share, int snum) { struct cli_state *c; struct nmb_name called, calling; -- cgit From 27b7e51a3cc619f879655a3230611457ac43b9e7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 14 Jan 2003 08:53:59 +0000 Subject: Merge from HEAD: - fstring/pstring mixups - the detection code that found them (disabled) - a bit of whitespace - a static Andrew Bartlett (This used to be commit 9b70fa868e7d9481f584c83fc4046174e1dedfd9) --- source3/torture/locktest.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index a62f7af1ad..5f9a63802b 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -193,14 +193,14 @@ static struct cli_state *connect_one(char *share, int snum) if (!got_pass) { char *pass = getpass("Password: "); if (pass) { - pstrcpy(password[0], pass); - pstrcpy(password[1], pass); + fstrcpy(password[0], pass); + fstrcpy(password[1], pass); } } if (got_pass == 1) { - pstrcpy(password[1], password[0]); - pstrcpy(username[1], username[0]); + fstrcpy(password[1], password[0]); + fstrcpy(username[1], username[0]); } if (!cli_session_setup(c, username[snum], @@ -591,8 +591,8 @@ static void usage(void) load_interfaces(); if (getenv("USER")) { - pstrcpy(username[0],getenv("USER")); - pstrcpy(username[1],getenv("USER")); + fstrcpy(username[0],getenv("USER")); + fstrcpy(username[1],getenv("USER")); } seed = time(NULL); @@ -613,11 +613,11 @@ static void usage(void) d_printf("Max of 2 usernames\n"); exit(1); } - pstrcpy(username[got_pass],optarg); + fstrcpy(username[got_pass],optarg); p = strchr_m(username[got_pass],'%'); if (p) { *p = 0; - pstrcpy(password[got_pass], p+1); + fstrcpy(password[got_pass], p+1); got_pass++; } break; -- cgit From 52db4c66986d880cde5c0f7df7b6a017a04ba10c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 24 Feb 2003 03:06:45 +0000 Subject: Missed a couple of files from the client-side kerberos merge (This used to be commit 56934f303c0551df858cc6d6ad32d0b37fcd1307) --- source3/torture/locktest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 5f9a63802b..63b9590dd6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -24,6 +24,7 @@ static fstring password[2]; static fstring username[2]; +static int got_user; static int got_pass; static BOOL use_kerberos; static int numops = 1000; @@ -602,13 +603,13 @@ static void usage(void) case 'k': #ifdef HAVE_KRB5 use_kerberos = True; - got_pass = True; #else d_printf("No kerberos support compiled in\n"); exit(1); #endif break; case 'U': + got_user = 1; if (got_pass == 2) { d_printf("Max of 2 usernames\n"); exit(1); @@ -663,6 +664,8 @@ static void usage(void) } } + if(use_kerberos && !got_user) got_pass = True; + argc -= optind; argv += optind; -- cgit From c507ebe56741d773bf6e7ad547863a2da1aee687 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2003 10:53:48 +0000 Subject: Patch from metze and me that adds dummy smb_register_*() functions so that is now possible to, for example, load a module which contains an auth method into a binary without the auth/ subsystem built in. (This used to be commit 74d9ecfe2dd7364643d32acb62ade957bd71cd0d) --- source3/torture/locktest.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 63b9590dd6..c18d2c100b 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static fstring password[2]; static fstring username[2]; static int got_user; -- cgit From 0914e541f5480834c1b0ddc98b5f71f7f7abf9cb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2003 11:49:51 +0000 Subject: Reverse previous patch from Stefan and me after comments by Andrew Bartlett (This used to be commit d817eaf0ecca2d878ab1ffcf7a747a02d71c811e) --- source3/torture/locktest.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index c18d2c100b..63b9590dd6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -22,8 +22,6 @@ #include "includes.h" -#include "module_dummy.h" - static fstring password[2]; static fstring username[2]; static int got_user; -- cgit From 80c1f1d865b13a63c7a60876b63458119566e044 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 22 Jul 2003 04:31:20 +0000 Subject: Fixup a bunch of printf-style functions and debugs to use unsigned long when displaying pid_t, uid_t and gid_t values. This removes a whole lot of warnings on some of the 64-bit build farm machines as well as help us out when 64-bit uid/gid/pid values come along. (This used to be commit f93528ba007c8800a850678f35f499fb7360fb9a) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 63b9590dd6..86379bf3b6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -157,7 +157,7 @@ static struct cli_state *connect_one(char *share, int snum) zero_ip(&ip); - slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); + slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); make_nmb_name(&calling, myname, 0x0); make_nmb_name(&called , server, 0x20); -- cgit From 55739e9f860a2a8f27a99fc2f79905a8ed143fee Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 7 May 2005 06:59:00 +0000 Subject: r6640: Attempt to fix 'make everything' with the paranoid malloc checker. Volker (This used to be commit 3db2799822da3711b47b60ba13daa07205ced45f) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 86379bf3b6..cdeebf2f8e 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -423,7 +423,7 @@ static void test_locks(char *share[NSERVERS]) ZERO_STRUCT(fnum); ZERO_STRUCT(cli); - recorded = (struct record *)malloc(sizeof(*recorded) * numops); + recorded = SMB_MALLOC_ARRAY(struct record, numops); for (n=0; n Date: Tue, 19 Jul 2005 02:37:04 +0000 Subject: r8572: Remove crufty #define NO_SYSLOG as it's not used at all anymore. (This used to be commit 985dbb47d925e79c1195ca219f7ab5d6648b22b8) --- source3/torture/locktest.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index cdeebf2f8e..a0698162d1 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -18,8 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define NO_SYSLOG - #include "includes.h" static fstring password[2]; -- cgit From 9df784b6f2fbcbc117992cc8f5f2a0b8c7d82275 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Nov 2005 16:00:35 +0000 Subject: r11556: Fix "make everything" (This used to be commit bff03f0cd484c04d5ab6d6b66f30191bef368b68) --- source3/torture/locktest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index a0698162d1..c8336ebaf6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -99,7 +99,7 @@ static struct record preset[] = { static struct record *recorded; -static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid, +static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, enum brl_type lock_type, br_off start, br_off size) { @@ -117,8 +117,8 @@ static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid, } #endif - printf("%6d %05x:%05x %s %.0f:%.0f(%.0f)\n", - (int)pid, (int)dev, (int)ino, + printf("%s %05x:%05x %s %.0f:%.0f(%.0f)\n", + procid_str_static(&pid), (int)dev, (int)ino, lock_type==READ_LOCK?"R":"W", (double)start, (double)start+size-1,(double)size); -- cgit From 9c15bd311db76885b27f30ba92d885833f668550 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sat, 28 Jan 2006 22:53:04 +0000 Subject: r13212: r12414@cabra: derrell | 2006-01-28 17:52:17 -0500 lp_load() could not be called multiple times to modify parameter settings based on reading from multiple configuration settings. Each time, it initialized all of the settings back to their defaults before reading the specified configuration file. This patch adds a parameter to lp_load() specifying whether the settings should be initialized. It does, however, still force the settings to be initialized the first time, even if the request was to not initialize them. (Not doing so could wreak havoc due to uninitialized values.) (This used to be commit f2a24de769d1b2266e576597c57a8e3b1e2a2b51) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index c8336ebaf6..913df885ba 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -586,7 +586,7 @@ static void usage(void) argc -= NSERVERS; argv += NSERVERS; - lp_load(dyn_CONFIGFILE,True,False,False); + lp_load(dyn_CONFIGFILE,True,False,False,True); load_interfaces(); if (getenv("USER")) { -- cgit From 38e020e51035c1df5e7c632e1c13d3b9111da792 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Mar 2006 21:42:39 +0000 Subject: r13796: Another load_case_tables... Jeremy. (This used to be commit 36df6ba3ad8b93744577ad92df0fe0b9bf9a4300) --- source3/torture/locktest.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 913df885ba..daf791963a 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -569,6 +569,8 @@ static void usage(void) setlinebuf(stdout); + load_case_tables(); + dbf = x_stderr; if (argc < 3 || argv[1][0] == '-') { -- cgit From c44de10a2bf4ed1d382ecf6940ffe393e92c5d27 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Mar 2006 23:23:05 +0000 Subject: r13799: Make locktest debug a little easier to read. Jeremy. (This used to be commit 13de4d000e04ffca41814554bdee8291ddb1efe2) --- source3/torture/locktest.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index daf791963a..b946e48666 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -51,6 +51,20 @@ static BOOL zero_zero; enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN}; +const char *lock_op_type(int op) +{ + if (op == WRITE_LOCK) return "write"; + else if (op == READ_LOCK) return "read"; + else return "other"; +} + +const char *lock_op_name(enum lock_op op) +{ + if (op == OP_LOCK) return "lock"; + else if (op == OP_UNLOCK) return "unlock"; + else return "reopen"; +} + struct record { enum lock_op lock_op; enum brl_type lock_type; @@ -520,9 +534,9 @@ static void test_locks(char *share[NSERVERS]) close_files(cli, fnum); for (i=0;i Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/torture/locktest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index b946e48666..3559a55a46 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -113,9 +113,13 @@ static struct record preset[] = { static struct record *recorded; -static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, - enum brl_type lock_type, - br_off start, br_off size) +static void print_brl(SMB_DEV_T dev, + SMB_INO_T ino, + struct process_id pid, + enum brl_type lock_type, + enum brl_flavour lock_flav, + br_off start, + br_off size) { #if NASTY_POSIX_LOCK_HACK { @@ -178,7 +182,7 @@ static struct cli_state *connect_one(char *share, int snum) zero_ip(&ip); /* have to open a new connection */ - if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { + if (!(c=cli_initialise()) || !cli_connect(c, server_n, &ip)) { DEBUG(0,("Connection to %s failed\n", server_n)); return NULL; } -- cgit From b29915d6113264bdce243005d29a1af9a8b69bde Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Aug 2006 17:14:16 +0000 Subject: r17571: Change the return code of cli_session_setup from BOOL to NTSTATUS Volker (This used to be commit 94817a8ef53589011bc4ead4e17807a101acf5c9) --- source3/torture/locktest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 3559a55a46..c3200ca038 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -220,10 +220,12 @@ static struct cli_state *connect_one(char *share, int snum) fstrcpy(username[1], username[0]); } - if (!cli_session_setup(c, username[snum], - password[snum], strlen(password[snum]), - password[snum], strlen(password[snum]), - lp_workgroup())) { + if (!NT_STATUS_IS_OK(cli_session_setup(c, username[snum], + password[snum], + strlen(password[snum]), + password[snum], + strlen(password[snum]), + lp_workgroup()))) { DEBUG(0,("session setup failed: %s\n", cli_errstr(c))); return NULL; } -- cgit From ef4c2088c5f1de5d8665061963acdd1d71500cd8 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Mon, 18 Dec 2006 20:37:26 +0000 Subject: r20245: merge 20244 from samba_3_0_24 get rid of more nested extern declarations warnings (This used to be commit e9df051f5201843e3428ddbed7a719553c2e799a) --- source3/torture/locktest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index c3200ca038..31fd0225f8 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -36,6 +36,9 @@ static unsigned min_length = 0; static BOOL exact_error_codes; static BOOL zero_zero; +extern char *optarg; +extern int optind; + #define FILENAME "\\locktest.dat" #define READ_PCT 50 @@ -581,8 +584,6 @@ static void usage(void) int main(int argc,char *argv[]) { char *share[NSERVERS]; - extern char *optarg; - extern int optind; int opt; char *p; int seed, server; -- cgit From 55ed1d59455566d90a03e7123fbf7a05a4bd4539 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Tue, 19 Dec 2006 20:16:52 +0000 Subject: r20261: merge 20260 from samba_3_0_24 clean up a bunch of no previous prototype warnings (This used to be commit c60687db112405262adf26dbf267804b04074e67) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 31fd0225f8..d248a9459d 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -54,14 +54,14 @@ extern int optind; enum lock_op {OP_LOCK, OP_UNLOCK, OP_REOPEN}; -const char *lock_op_type(int op) +static const char *lock_op_type(int op) { if (op == WRITE_LOCK) return "write"; else if (op == READ_LOCK) return "read"; else return "other"; } -const char *lock_op_name(enum lock_op op) +static const char *lock_op_name(enum lock_op op) { if (op == OP_LOCK) return "lock"; else if (op == OP_UNLOCK) return "unlock"; -- cgit From e6383f47629368d9dd4e803f17566a24e9d7359e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 May 2007 09:35:35 +0000 Subject: r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch. This changes "struct process_id" to "struct server_id", keeping both is just too much hassle. No functional change (I hope ;-)) Volker (This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index d248a9459d..792ada61a9 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -118,7 +118,7 @@ static struct record *recorded; static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, - struct process_id pid, + struct server_id pid, enum brl_type lock_type, enum brl_flavour lock_flav, br_off start, -- cgit From e8156439f24137b5418baad20a7f00f6949cfe29 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 09:30:34 +0000 Subject: r23183: Check in a change made by Tridge: This replaces the internal explicit dev/ino file id representation by a "struct file_id". This is necessary as cluster file systems and NFS don't necessarily assign the same device number to the shared file system. With this structure in place we can now easily add different schemes to map a file to a unique 64-bit device node. Jeremy, you might note that I did not change the external interface of smb_share_modes.c. Volker (This used to be commit 9b10dbbd5de8813fc15ebbb6be9b18010ffe8139) --- source3/torture/locktest.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 792ada61a9..92838f0ff2 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -116,8 +116,7 @@ static struct record preset[] = { static struct record *recorded; -static void print_brl(SMB_DEV_T dev, - SMB_INO_T ino, +static void print_brl(struct file_id id, struct server_id pid, enum brl_type lock_type, enum brl_flavour lock_flav, @@ -138,8 +137,8 @@ static void print_brl(SMB_DEV_T dev, } #endif - printf("%s %05x:%05x %s %.0f:%.0f(%.0f)\n", - procid_str_static(&pid), (int)dev, (int)ino, + printf("%s %s %s %.0f:%.0f(%.0f)\n", + procid_str_static(&pid), file_id_static_string(&id), lock_type==READ_LOCK?"R":"W", (double)start, (double)start+size-1,(double)size); -- cgit From d3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 13:26:44 +0000 Subject: r23195: Add void *private_data to brl_forall (This used to be commit c91b2bdc160d76bf0b0770fe7f92cbc7124d6c3c) --- source3/torture/locktest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 92838f0ff2..7a970488b3 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -121,7 +121,8 @@ static void print_brl(struct file_id id, enum brl_type lock_type, enum brl_flavour lock_flav, br_off start, - br_off size) + br_off size, + void *private_data) { #if NASTY_POSIX_LOCK_HACK { @@ -147,7 +148,7 @@ static void print_brl(struct file_id id, static void show_locks(void) { - brl_forall(print_brl); + brl_forall(print_brl, NULL); /* system("cat /proc/locks"); */ } -- cgit From ce02d0dfcbeeeec316578322257d998589090c6f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 20 Jun 2007 17:38:42 +0000 Subject: r23554: Fix bug #4711 by makeing cli_connect return an NTSTATUS. Long overdue fix.... Jeremy. (This used to be commit 073fdc5a58139796dbaa7ea9833dca5308f11282) --- source3/torture/locktest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 7a970488b3..8d3234e367 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -165,6 +165,7 @@ static struct cli_state *connect_one(char *share, int snum) struct in_addr ip; fstring myname; static int count; + NTSTATUS status; fstrcpy(server,share+2); share = strchr_m(server,'\\'); @@ -185,11 +186,17 @@ static struct cli_state *connect_one(char *share, int snum) zero_ip(&ip); /* have to open a new connection */ - if (!(c=cli_initialise()) || !cli_connect(c, server_n, &ip)) { + if (!(c=cli_initialise())) { DEBUG(0,("Connection to %s failed\n", server_n)); return NULL; } + status = cli_connect(c, server_n, &ip); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Connection to %s failed. Error %s\n", server_n, nt_errstr(status) )); + return NULL; + } + c->use_kerberos = use_kerberos; if (!cli_session_request(c, &calling, &called)) { -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 8d3234e367..97242541d4 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/torture/locktest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 97242541d4..34068cf0d7 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 4ee8b2937d48308c6089fb539fdbd8625dfde360 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 10 Sep 2007 10:56:07 +0000 Subject: r25055: Add file_id_string_tos This removes file_id_string_static and file_id_string_static2 (This used to be commit 638c848c9afe374feb30e34c494f89b2a6c64f7b) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 34068cf0d7..9e4b895316 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -138,7 +138,7 @@ static void print_brl(struct file_id id, #endif printf("%s %s %s %.0f:%.0f(%.0f)\n", - procid_str_static(&pid), file_id_static_string(&id), + procid_str_static(&pid), file_id_string_tos(&id), lock_type==READ_LOCK?"R":"W", (double)start, (double)start+size-1,(double)size); -- cgit From 8e54530b52fd256137740107e9fdf000f00a7a30 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Oct 2007 18:25:16 -0700 Subject: Add start of IPv6 implementation. Currently most of this is avoiding IPv6 in winbindd, but moves most of the socket functions that were wrongly in lib/util.c into lib/util_sock.c and provides generic IPv4/6 independent versions of most things. Still lots of work to do, but now I can see how I'll fix the access check code. Nasty part that remains is the name resolution code which is used to returning arrays of in_addr structs. Jeremy. (This used to be commit 3f6bd0e1ec5cc6670f3d08f76fc2cd94c9cd1a08) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 9e4b895316..394a237a03 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -174,7 +174,7 @@ static struct cli_state *connect_one(char *share, int snum) server_n = server; - zero_ip(&ip); + zero_ip_v4(&ip); slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); @@ -182,7 +182,7 @@ static struct cli_state *connect_one(char *share, int snum) make_nmb_name(&called , server, 0x20); again: - zero_ip(&ip); + zero_ip_v4(&ip); /* have to open a new connection */ if (!(c=cli_initialise())) { -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/torture/locktest.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 394a237a03..20fd49b3e1 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -23,17 +23,17 @@ static fstring password[2]; static fstring username[2]; static int got_user; static int got_pass; -static BOOL use_kerberos; +static bool use_kerberos; static int numops = 1000; -static BOOL showall; -static BOOL analyze; -static BOOL hide_unlock_fails; -static BOOL use_oplocks; +static bool showall; +static bool analyze; +static bool hide_unlock_fails; +static bool use_oplocks; static unsigned lock_range = 100; static unsigned lock_base = 0; static unsigned min_length = 0; -static BOOL exact_error_codes; -static BOOL zero_zero; +static bool exact_error_codes; +static bool zero_zero; extern char *optarg; extern int optind; @@ -295,7 +295,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 cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES], struct record *rec) { @@ -305,7 +305,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], SMB_BIG_UINT len = rec->len; enum brl_type op = rec->lock_type; int server; - BOOL ret[NSERVERS]; + bool ret[NSERVERS]; NTSTATUS status[NSERVERS]; switch (rec->lock_op) { -- cgit From f88b7a076be74a29a3bf876b4e2705f4a1ecf42b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 24 Oct 2007 14:16:54 -0700 Subject: This is a large patch (sorry). Migrate from struct in_addr to struct sockaddr_storage in most places that matter (ie. not the nmbd and NetBIOS lookups). This passes make test on an IPv4 box, but I'll have to do more work/testing on IPv6 enabled boxes. This should now give us a framework for testing and finishing the IPv6 migration. It's at the state where someone with a working IPv6 setup should (theorecically) be able to type : smbclient //ipv6-address/share and have it work. Jeremy. (This used to be commit 98e154c3125d5732c37a72d74b0eb5cd7b6155fd) --- source3/torture/locktest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 20fd49b3e1..f69f8bf48f 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -161,7 +161,7 @@ static struct cli_state *connect_one(char *share, int snum) struct nmb_name called, calling; char *server_n; fstring server; - struct in_addr ip; + struct sockaddr_storage ss; fstring myname; static int count; NTSTATUS status; @@ -173,8 +173,8 @@ static struct cli_state *connect_one(char *share, int snum) share++; server_n = server; - - zero_ip_v4(&ip); + + zero_addr(&ss, AF_INET); slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); @@ -182,7 +182,7 @@ static struct cli_state *connect_one(char *share, int snum) make_nmb_name(&called , server, 0x20); again: - zero_ip_v4(&ip); + zero_addr(&ss, AF_INET); /* have to open a new connection */ if (!(c=cli_initialise())) { @@ -190,7 +190,7 @@ static struct cli_state *connect_one(char *share, int snum) return NULL; } - status = cli_connect(c, server_n, &ip); + status = cli_connect(c, server_n, &ss); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Connection to %s failed. Error %s\n", server_n, nt_errstr(status) )); return NULL; -- cgit From d4307679b95088d05f0abad440de5e961ee965df Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 27 Oct 2007 20:29:36 -0700 Subject: Change all occurrences of zero_addr(&ss,AF_INET) to zero_addr(&ss). All current uses were always of the AF_INET form, so simplify the call. If in the future we need to zero an addr to AF_INET6 this can be done separately. Jeremy. (This used to be commit 2e92418a138bf2738b77b7e0fcb2fa37ad84fc0c) --- source3/torture/locktest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index f69f8bf48f..baf676f646 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -174,7 +174,7 @@ static struct cli_state *connect_one(char *share, int snum) server_n = server; - zero_addr(&ss, AF_INET); + zero_addr(&ss); slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); @@ -182,7 +182,7 @@ static struct cli_state *connect_one(char *share, int snum) make_nmb_name(&called , server, 0x20); again: - zero_addr(&ss, AF_INET); + zero_addr(&ss); /* have to open a new connection */ if (!(c=cli_initialise())) { -- cgit From de7fd585b11413113304334dd75ba6a207ec69eb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 4 Dec 2007 16:56:18 -0800 Subject: The usual !pstring... Jeremy. (This used to be commit b676262a781363e7be49b21817668a53cca75c2d) --- source3/torture/locktest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index baf676f646..4dc8e53578 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -125,13 +125,15 @@ static void print_brl(struct file_id id, { #if NASTY_POSIX_LOCK_HACK { - pstring cmd; static SMB_INO_T lastino; if (lastino != ino) { - slprintf(cmd, sizeof(cmd), - "egrep POSIX.*%u /proc/locks", (int)ino); - system(cmd); + char *cmd; + if (asprintf(&cmd, + "egrep POSIX.*%u /proc/locks", (int)ino) > 0) { + system(cmd); + SAFE_FREE(cmd); + } } lastino = ino; } -- cgit From 7faee02d0d351c5c039e8f1be7e82ce3a93cbe96 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Dec 2007 11:30:37 -0800 Subject: Remove the char[1024] strings from dynconfig. Replace them with malloc'ing accessor functions. Should save a lot of static space :-). Jeremy. (This used to be commit 52dc5eaef2106015b3a8b659e818bdb15ad94b05) --- source3/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/locktest.c') diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index 4dc8e53578..2ba5ab8f06 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -617,7 +617,7 @@ static void usage(void) argc -= NSERVERS; argv += NSERVERS; - lp_load(dyn_CONFIGFILE,True,False,False,True); + lp_load(get_dyn_CONFIGFILE(),True,False,False,True); load_interfaces(); if (getenv("USER")) { -- cgit