summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-10-19 10:27:14 +0200
committerJeremy Allison <jra@samba.org>2016-10-20 02:48:30 +0200
commitbeda6d3d48c30945bf4eac7d1d9e73967856bb51 (patch)
tree82388438a16cfbe14a63da639b3474226847071d /source4/torture/smb2
parentc21a6eda370fa0b0698a5e1fd565bd2e014d326a (diff)
downloadsamba-beda6d3d48c30945bf4eac7d1d9e73967856bb51.tar.gz
torture: Fix uninitialized variables
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Oct 20 02:48:30 CEST 2016 on sn-devel-144
Diffstat (limited to 'source4/torture/smb2')
-rw-r--r--source4/torture/smb2/acls.c15
-rw-r--r--source4/torture/smb2/create.c3
-rw-r--r--source4/torture/smb2/dir.c5
-rw-r--r--source4/torture/smb2/durable_open.c16
-rw-r--r--source4/torture/smb2/lease.c45
-rw-r--r--source4/torture/smb2/lock.c46
-rw-r--r--source4/torture/smb2/notify.c5
-rw-r--r--source4/torture/smb2/streams.c12
8 files changed, 98 insertions, 49 deletions
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index d4c575b9fa7..beb5abf8e8d 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -99,7 +99,7 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
struct smb2_create io;
const char *fname = BASEDIR "\\creator.txt";
bool ret = true;
- struct smb2_handle handle;
+ struct smb2_handle handle = {{0}};
union smb_fileinfo q;
union smb_setfileinfo set;
struct security_descriptor *sd, *sd_orig, *sd2;
@@ -301,7 +301,7 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
struct smb2_create io;
const char *fname = BASEDIR "\\generic.txt";
bool ret = true;
- struct smb2_handle handle;
+ struct smb2_handle handle = {{0}};
int i;
union smb_fileinfo q;
union smb_setfileinfo set;
@@ -667,7 +667,7 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
struct smb2_create io;
const char *fname = BASEDIR "\\test_owner_bits.txt";
bool ret = true;
- struct smb2_handle handle;
+ struct smb2_handle handle = {{0}};
int i;
union smb_fileinfo q;
union smb_setfileinfo set;
@@ -803,7 +803,8 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
const char *fname1 = BASEDIR "\\inheritance\\testfile";
const char *fname2 = BASEDIR "\\inheritance\\testdir";
bool ret = true;
- struct smb2_handle handle, handle2;
+ struct smb2_handle handle = {{0}};
+ struct smb2_handle handle2 = {{0}};
int i;
union smb_fileinfo q;
union smb_setfileinfo set;
@@ -1278,7 +1279,8 @@ static bool test_inheritance_flags(struct torture_context *tctx,
const char *dname = BASEDIR "\\inheritance";
const char *fname1 = BASEDIR "\\inheritance\\testfile";
bool ret = true;
- struct smb2_handle handle, handle2;
+ struct smb2_handle handle = {{0}};
+ struct smb2_handle handle2 = {{0}};
int i, j;
union smb_fileinfo q;
union smb_setfileinfo set;
@@ -1510,7 +1512,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
const char *dname = BASEDIR "\\inheritance";
const char *fname1 = BASEDIR "\\inheritance\\testfile";
bool ret = true;
- struct smb2_handle handle, handle2;
+ struct smb2_handle handle = {{0}};
+ struct smb2_handle handle2 = {{0}};
union smb_fileinfo q;
union smb_setfileinfo set;
struct security_descriptor *sd, *sd_orig=NULL;
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index 9b384006026..09a17be0c9f 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -706,7 +706,8 @@ static bool test_smb2_open(struct torture_context *tctx,
const char *fname = DNAME "\\torture_ntcreatex.txt";
const char *dname = DNAME "\\torture_ntcreatex.dir";
NTSTATUS status;
- struct smb2_handle h, h1;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
bool ret = true;
int i;
struct {
diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
index 715e9846cf5..2e5db9128aa 100644
--- a/source4/torture/smb2/dir.c
+++ b/source4/torture/smb2/dir.c
@@ -203,7 +203,8 @@ static bool test_fixed(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create create;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
struct smb2_find f;
union smb_search_data *d;
struct file_elem files[NFILES] = {};
@@ -1265,7 +1266,7 @@ static bool test_large_files(struct torture_context *tctx,
NTSTATUS status;
struct smb2_create create;
struct smb2_find f;
- struct smb2_handle h;
+ struct smb2_handle h = {{0}};
union smb_search_data *d;
int i, j, file_count = 0;
char **strs = NULL;
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 7b595667db9..2e68170077a 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -1918,7 +1918,8 @@ static bool test_durable_open_oplock(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io1, io2;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
char fname[256];
bool ret = true;
@@ -1993,7 +1994,8 @@ static bool test_durable_open_lease(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io1, io2;
struct smb2_lease ls1, ls2;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
char fname[256];
bool ret = true;
@@ -2092,7 +2094,7 @@ static bool test_durable_open_lock_oplock(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
- struct smb2_handle h;
+ struct smb2_handle h = {{0}};
struct smb2_lock lck;
struct smb2_lock_element el[2];
NTSTATUS status;
@@ -2174,7 +2176,7 @@ static bool test_durable_open_lock_lease(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h;
+ struct smb2_handle h = {{0}};
struct smb2_lock lck;
struct smb2_lock_element el[2];
NTSTATUS status;
@@ -2279,7 +2281,8 @@ static bool test_durable_open_open2_lease(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io1, io2;
struct smb2_lease ls;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
char fname[256];
bool ret = true;
@@ -2385,7 +2388,8 @@ static bool test_durable_open_open2_oplock(struct torture_context *tctx,
{
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io1, io2;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
char fname[256];
bool ret = true;
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 6a2e88b0d00..3ee915cc952 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -121,7 +121,8 @@ static bool test_lease_request(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
const char *fname = "lease_request.dat";
const char *fname2 = "lease_request.2.dat";
@@ -209,7 +210,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h, hnew;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle hnew = {{0}};
NTSTATUS status;
const char *fname = "lease_upgrade.dat";
bool ret = true;
@@ -840,7 +842,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
const char *fname = "lease_nobreakself.dat";
bool ret = true;
@@ -919,7 +922,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
NTSTATUS status;
const char *fname = "lease_statopen.dat";
bool ret = true;
@@ -1192,7 +1196,9 @@ static bool test_lease_multibreak(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h, h2, h3;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_handle h3 = {{0}};
struct smb2_write w;
NTSTATUS status;
const char *fname = "lease_multibreak.dat";
@@ -1311,7 +1317,7 @@ static bool test_lease_v2_request_parent(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls;
- struct smb2_handle h1;
+ struct smb2_handle h1 = {{0}};
uint64_t parent = LEASE2;
NTSTATUS status;
const char *fname = "lease_v2_request_parent.dat";
@@ -1367,7 +1373,7 @@ static bool test_lease_break_twice(struct torture_context *tctx,
struct smb2_create io;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h1;
+ struct smb2_handle h1 = {{0}};
NTSTATUS status;
const char *fname = "lease_break_twice.dat";
bool ret = true;
@@ -1439,7 +1445,11 @@ static bool test_lease_v2_request(struct torture_context *tctx,
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_create io;
struct smb2_lease ls1, ls2, ls2t, ls3, ls4;
- struct smb2_handle h1, h2, h3, h4, h5;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_handle h3 = {{0}};
+ struct smb2_handle h4 = {{0}};
+ struct smb2_handle h5 = {{0}};
struct smb2_write w;
NTSTATUS status;
const char *fname = "lease_v2_request.dat";
@@ -3060,7 +3070,9 @@ static bool test_lease_complex1(struct torture_context *tctx,
struct smb2_create io2;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h, h2, h3;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_handle h3 = {{0}};
struct smb2_write w;
NTSTATUS status;
const char *fname = "lease_complex1.dat";
@@ -3186,7 +3198,9 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
struct smb2_create io2;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h, h2, h3;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_handle h3 = {{0}};
struct smb2_write w;
NTSTATUS status;
const char *fname = "lease_v2_complex1.dat";
@@ -3331,7 +3345,8 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
struct smb2_create io2;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
struct smb2_request *req2 = NULL;
struct smb2_lease_break_ack ack = {};
NTSTATUS status;
@@ -3440,7 +3455,9 @@ static bool test_lease_timeout(struct torture_context *tctx,
struct smb2_create io;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h, hnew, h1b;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle hnew = {{0}};
+ struct smb2_handle h1b = {{0}};
NTSTATUS status;
const char *fname = "lease_timeout.dat";
bool ret = true;
@@ -3568,7 +3585,9 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
struct smb2_create io;
struct smb2_lease ls1;
struct smb2_lease ls2;
- struct smb2_handle h, h1, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
union smb_setfileinfo sinfo;
const char *fname = "lease_v2_rename_src.dat";
const char *fname_dst = "lease_v2_rename_dst.dat";
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 3900abf50ad..ff422113caa 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -587,7 +587,8 @@ static bool test_lock(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -799,7 +800,8 @@ static bool test_async(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -867,7 +869,8 @@ static bool test_cancel(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -995,7 +998,8 @@ static bool test_cancel_tdis(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -1089,7 +1093,8 @@ static bool test_cancel_logoff(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -1185,7 +1190,8 @@ static bool test_errorcode(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[2];
@@ -1348,7 +1354,8 @@ static bool test_zerobytelength(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
int i;
@@ -1467,7 +1474,8 @@ static bool test_zerobyteread(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
@@ -1585,7 +1593,8 @@ static bool test_unlock(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el1[1];
@@ -2136,7 +2145,8 @@ static bool test_stacking(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
@@ -2339,7 +2349,8 @@ static bool test_contend(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
@@ -2408,7 +2419,8 @@ static bool test_context(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
@@ -2474,7 +2486,8 @@ static bool test_range(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
@@ -2675,7 +2688,9 @@ static bool test_overlap(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2, h3;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
+ struct smb2_handle h3 = {{0}};
uint8_t buf[200];
bool correct = true;
@@ -2775,7 +2790,8 @@ static bool test_truncate(struct torture_context *torture,
{
NTSTATUS status;
bool ret = true;
- struct smb2_handle h, h2;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h2 = {{0}};
uint8_t buf[200];
struct smb2_lock lck;
struct smb2_lock_element el[1];
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index d9b0f593e32..90f5ad9a633 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -234,7 +234,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
union smb_open io;
union smb_close cl;
int i, count;
- struct smb2_handle h1, h2;
+ struct smb2_handle h1 = {{0}};
+ struct smb2_handle h2 = {{0}};
struct smb2_request *req, *req2;
const char *fname = BASEDIR "\\subdir-name";
extern int torture_numops;
@@ -2110,7 +2111,7 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
NTSTATUS status;
union smb_notify notify;
union smb_open io;
- struct smb2_handle h1;
+ struct smb2_handle h1 = {{0}};
struct smb2_request *req = NULL;
struct smb2_tree *tree1 = NULL;
const char *fname = BASEDIR "\\subdir-name";
diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c
index 8c3f1615275..e48a217fe94 100644
--- a/source4/torture/smb2/streams.c
+++ b/source4/torture/smb2/streams.c
@@ -675,7 +675,8 @@ static bool test_stream_delete(struct torture_context *tctx,
const char *fname = DNAME "\\stream_delete.txt";
const char *sname1;
bool ret = true;
- struct smb2_handle h, h1;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
struct smb2_read r;
if (torture_setting_bool(tctx, "samba4", false)) {
@@ -1146,7 +1147,8 @@ static bool test_stream_names2(struct torture_context *tctx,
union smb_open io;
const char *fname = DNAME "\\stream_names2.txt";
bool ret = true;
- struct smb2_handle h, h1;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
uint8_t i;
smb2_util_unlink(tree, fname);
@@ -1247,7 +1249,8 @@ static bool test_stream_rename(struct torture_context *tctx,
union smb_fileinfo finfo1;
union smb_setfileinfo sfinfo;
bool ret = true;
- struct smb2_handle h, h1;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
sname1 = talloc_asprintf(mem_ctx, "%s:%s", fname, "Stream One");
sname2 = talloc_asprintf(mem_ctx, "%s:%s:$DaTa", fname,
@@ -1506,7 +1509,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
const char *default_stream_name = "::$DATA";
const char *stream_list[2];
bool ret = true;
- struct smb2_handle h, h1;
+ struct smb2_handle h = {{0}};
+ struct smb2_handle h1 = {{0}};
/* clean slate .. */
smb2_util_unlink(tree, fname);