>From caceafeebf4a5c8a836ce62dd5b1d95b8d64875a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 17 Oct 2016 20:56:20 +0200 Subject: [PATCH 1/8] vfs: Fix warnings for time_t != long Signed-off-by: Volker Lendecke --- source3/modules/vfs_snapper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 5c1821d..a0d3d91 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -1842,12 +1842,13 @@ static NTSTATUS snapper_get_snap_at_time_call(TALLOC_CTX *mem_ctx, } if (num_snaps == 0) { - DEBUG(4, ("no snapshots found with time: %lu\n", snaptime)); + DEBUG(4, ("no snapshots found with time: %lu\n", + (unsigned long)snaptime)); status = NT_STATUS_INVALID_PARAMETER; goto err_snap_array_free; } else if (num_snaps > 0) { DEBUG(4, ("got %u snapshots for single time %lu, using top\n", - num_snaps, snaptime)); + num_snaps, (unsigned long)snaptime)); } status = snapper_snap_id_to_path(mem_ctx, base_path, snaps[0].id, -- 2.1.4 >From 905839dc55b5d9bd9653ed31e2592e39108f3dad Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 17 Oct 2016 21:40:25 +0200 Subject: [PATCH 2/8] ldb: Fix a signed/unsigned mixup Signed-off-by: Volker Lendecke --- lib/ldb/ldb_tdb/ldb_index.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c index 7924172..53fcde5 100644 --- a/lib/ldb/ldb_tdb/ldb_index.c +++ b/lib/ldb/ldb_tdb/ldb_index.c @@ -1210,7 +1210,8 @@ static int ltdb_index_add_el(struct ldb_module *module, const char *dn, add index entries for all elements in a message */ static int ltdb_index_add_all(struct ldb_module *module, const char *dn, - struct ldb_message_element *elements, int num_el, + struct ldb_message_element *elements, + unsigned int num_el, bool is_new) { struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private); -- 2.1.4 >From 352b5b6ec24c3c9ba4b8598ad6652cd0d24d456b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Oct 2016 08:26:07 +0200 Subject: [PATCH 3/8] lib: Fix an uninitialized variable Signed-off-by: Volker Lendecke --- source3/libads/ldap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 9e2ed98..b01201e 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2947,6 +2947,7 @@ ADS_STATUS ads_current_time(ADS_STRUCT *ads) if ( (ads_s = ads_init( ads->server.realm, ads->server.workgroup, ads->server.ldap_server )) == NULL ) { + status = ADS_ERROR(LDAP_NO_MEMORY); goto done; } ads_s->auth.flags = ADS_AUTH_ANON_BIND; -- 2.1.4 >From 3b175e09ad6aebf9240b7648f96b945022f9be0e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Oct 2016 08:42:37 +0200 Subject: [PATCH 4/8] torture: Fix uninitialized variables Found by clang on freebsd Signed-off-by: Volker Lendecke --- source4/torture/smb2/acls.c | 15 +++++++----- source4/torture/smb2/create.c | 3 ++- source4/torture/smb2/dir.c | 5 ++-- source4/torture/smb2/durable_open.c | 16 ++++++++----- source4/torture/smb2/lease.c | 45 +++++++++++++++++++++++++----------- source4/torture/smb2/lock.c | 46 +++++++++++++++++++++++++------------ source4/torture/smb2/notify.c | 5 ++-- source4/torture/smb2/streams.c | 12 ++++++---- source4/torture/vfs/acl_xattr.c | 6 +++-- 9 files changed, 102 insertions(+), 51 deletions(-) diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c index d4c575b..acd8a82 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 9b38400..f8c2776 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 715e984..86a2c4e 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 7b59566..a15a1f4 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 6a2e88b..9e9aae3 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 3900abf..47272a5 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 d9b0f59..c3fe2be 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 8c3f161..6decd04 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); diff --git a/source4/torture/vfs/acl_xattr.c b/source4/torture/vfs/acl_xattr.c index df4dd29..ad155e9 100644 --- a/source4/torture/vfs/acl_xattr.c +++ b/source4/torture/vfs/acl_xattr.c @@ -91,7 +91,8 @@ static bool test_default_acl_posix(struct torture_context *tctx, bool ret = true; const char *dname = BASEDIR "\\testdir"; const char *fname = BASEDIR "\\testdir\\testfile"; - struct smb2_handle fhandle, dhandle; + struct smb2_handle fhandle = {0}; + struct smb2_handle dhandle = {0}; union smb_fileinfo q; union smb_setfileinfo set; struct security_descriptor *sd = NULL; @@ -200,7 +201,8 @@ static bool test_default_acl_win(struct torture_context *tctx, bool ret = true; const char *dname = BASEDIR "\\testdir"; const char *fname = BASEDIR "\\testdir\\testfile"; - struct smb2_handle fhandle, dhandle; + struct smb2_handle fhandle = {0}; + struct smb2_handle dhandle = {0}; union smb_fileinfo q; union smb_setfileinfo set; struct security_descriptor *sd = NULL; -- 2.1.4 >From 94b614455ab5144bcc269e638774cec1ac381111 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Oct 2016 12:45:28 +0200 Subject: [PATCH 5/8] loadparm: Fix a warning for increased alignment There's tons of those, but you have to start somewhere :-) Signed-off-by: Volker Lendecke --- source3/param/loadparm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 9306444..3e1a15e 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1943,7 +1943,7 @@ int getservicebyname(const char *pszServiceName, struct loadparm_service *pservi (data.dptr != NULL) && (data.dsize == sizeof(iService))) { - iService = *(int *)data.dptr; + memcpy(&iService, data.dptr, sizeof(iService)); } TALLOC_FREE(canon_name); -- 2.1.4 >From 5173f194fc12e2c11baa55bcb90926228bcf2b3b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Oct 2016 12:51:16 +0200 Subject: [PATCH 6/8] lib: Fix a signed/unsigned hickup Signed-off-by: Volker Lendecke --- source3/librpc/crypto/gse_krb5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/librpc/crypto/gse_krb5.c b/source3/librpc/crypto/gse_krb5.c index 2ee075d..71b2338 100644 --- a/source3/librpc/crypto/gse_krb5.c +++ b/source3/librpc/crypto/gse_krb5.c @@ -373,7 +373,7 @@ static krb5_error_code fill_mem_keytab_from_system_keytab(krb5_context krbctx, NULL, NULL, NULL, NULL }; char *entry_princ_s = NULL; fstring my_name, my_fqdn; - int i; + unsigned i; int err; /* Generate the list of principal names which we expect -- 2.1.4 >From 6edb56a2aced4de9437a265c98d25cbe79295cea Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Oct 2016 13:27:00 +0200 Subject: [PATCH 7/8] torture: Fix clang errors h1.data is an array and as such always is != NULL, so it's always true Signed-off-by: Volker Lendecke --- source4/torture/smb2/rename.c | 28 ++++++++++++++-------------- source4/torture/vfs/fruit.c | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source4/torture/smb2/rename.c b/source4/torture/smb2/rename.c index 23fe4f9..1a490f3 100644 --- a/source4/torture/smb2/rename.c +++ b/source4/torture/smb2/rename.c @@ -120,7 +120,7 @@ done: torture_comment(torture, "Cleaning up\n"); - if (h1.data) { + if (h1.data[0] || h1.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = h1; @@ -199,7 +199,7 @@ done: torture_comment(torture, "Cleaning up\n"); - if (h1.data) { + if (h1.data[0] || h1.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = h1; @@ -288,7 +288,7 @@ done: torture_comment(torture, "Cleaning up\n"); - if (h1.data) { + if (h1.data[0] || h1.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = h1; @@ -405,13 +405,13 @@ done: torture_comment(torture, "Cleaning up\n"); - if (fh.data) { + if (fh.data[0] || fh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = fh; status = smb2_close(tree1, &(cl.smb2)); } - if (dh.data) { + if (dh.data[0] || dh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = dh; @@ -529,13 +529,13 @@ done: torture_comment(torture, "Cleaning up\n"); - if (fh.data) { + if (fh.data[0] || fh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = fh; status = smb2_close(tree1, &(cl.smb2)); } - if (dh.data) { + if (dh.data[0] || dh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = dh; @@ -663,13 +663,13 @@ done: torture_comment(torture, "Cleaning up\n"); - if (fh.data) { + if (fh.data[0] || fh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = fh; status = smb2_close(tree1, &(cl.smb2)); } - if (dh.data) { + if (dh.data[0] || dh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = dh; @@ -787,13 +787,13 @@ done: torture_comment(torture, "Cleaning up\n"); - if (fh.data) { + if (fh.data[0] || fh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = fh; status = smb2_close(tree1, &(cl.smb2)); } - if (dh.data) { + if (dh.data[0] || dh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = dh; @@ -911,13 +911,13 @@ done: torture_comment(torture, "Cleaning up\n"); - if (fh.data) { + if (fh.data[0] || fh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = fh; status = smb2_close(tree1, &(cl.smb2)); } - if (dh.data) { + if (dh.data[0] || dh.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = dh; @@ -1011,7 +1011,7 @@ done: torture_comment(torture, "Cleaning up\n"); - if (h1.data) { + if (h1.data[0] || h1.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = h1; diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index 020bd1f..d5de9d5 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -2841,7 +2841,7 @@ static bool test_rename_dir_openfile(struct torture_context *torture, torture_comment(torture, "Cleaning up\n"); - if (h1.data) { + if (h1.data[0] || h1.data[1]) { ZERO_STRUCT(cl.smb2); cl.smb2.level = RAW_CLOSE_SMB2; cl.smb2.in.file.handle = h1; -- 2.1.4 >From 9b759b98d129f868616402714472eb84cdbdc535 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 13 Oct 2016 16:20:12 +0200 Subject: [PATCH 8/8] libsmb: "cli" is not needed in cli_smb2_shadow_copy_data_fnum_state We only have a single subreq Signed-off-by: Volker Lendecke --- source3/libsmb/cli_smb2_fnum.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index cf00f60..ad57cf7 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -3303,7 +3303,6 @@ NTSTATUS cli_smb2_splice_recv(struct tevent_req *req, off_t *written) ***************************************************************/ struct cli_smb2_shadow_copy_data_fnum_state { - struct cli_state *cli; uint16_t fnum; struct smb2_hnd *ph; DATA_BLOB out_input_buffer; @@ -3334,7 +3333,6 @@ static struct tevent_req *cli_smb2_shadow_copy_data_fnum_send( return tevent_req_post(req, ev); } - state->cli = cli; state->fnum = fnum; status = map_fnum_to_smb2_handle(cli, fnum, &state->ph); -- 2.1.4