Bug 12299 - unitialized variable warnings in smbd open.c and close.c
Summary: unitialized variable warnings in smbd open.c and close.c
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.4.6
Hardware: All All
: P5 major (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-29 21:22 UTC by Steve French
Modified: 2016-11-17 07:47 UTC (History)
2 users (show)

See Also:


Attachments
git-am fix for 4.4.x (820 bytes, patch)
2016-10-07 00:02 UTC, Jeremy Allison
sfrench: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve French 2016-09-29 21:22:22 UTC
Compiling Samba 4.4 (current 4.4-test branch and older) with --enable-developer fails.  Most of these have been fixed in 4.5 or later, but two (one in smbd/open.c and one in smbd/close.c) only apply to 4.4 and are not fixed in later releases.

These are uninitialized variables (saved_posix_pathnames).  Jeremy has a better patch that he suggested after seeing my suggested patch (see below) so the patch below may just be useful to see the failing lines.

Subject: [PATCH] s3/smbd: Fix unitialized variables in Samba 4.4 file server

./configure --enable-developer fails on a few unitialized variables on 4.4
Although most have been fixed in master, this code was removed for 4.5 and
later, so these two cases would not apply to them and only 4.4, but they
do fall through to error handling code which use them and should be fixed.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 source3/smbd/close.c | 2 +-
 source3/smbd/open.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 271885e..d092d94 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -168,7 +168,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
 	unsigned int num_streams = 0;
 	TALLOC_CTX *frame = talloc_stackframe();
 	NTSTATUS status;
-	bool saved_posix_pathnames;
+	bool saved_posix_pathnames = false;
 
 	status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
 				&num_streams, &stream_info);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5935ff5..7878912 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3871,7 +3871,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
 	unsigned int num_streams = 0;
 	TALLOC_CTX *frame = talloc_stackframe();
 	NTSTATUS status;
-	bool saved_posix_pathnames;
+	bool saved_posix_pathnames = false;
 
 	status = vfs_streaminfo(conn, NULL, fname, talloc_tos(),
 				&num_streams, &stream_info);
--
Comment 1 Jeremy Allison 2016-10-05 21:11:44 UTC
This is the wrong fix. Steve, can you attach my alternative proposed fix as a git-am fix and ask me to review and I'll +1.
Comment 2 Jeremy Allison 2016-10-07 00:02:48 UTC
Created attachment 12551 [details]
git-am fix for 4.4.x

Steve, +1 this and we'll get it into 4.4.next.
Comment 3 Steve French 2016-11-15 05:27:10 UTC
I thought I already +1 this, but in any case ... Reviewed-by: Steve French <smfrench@gmail.com>
Comment 4 Jeremy Allison 2016-11-15 16:49:16 UTC
(In reply to Steve French from comment #3)

Steve, you need to go into the 'Details' link and change the '?' to '+'. *That* is how you +1 a patch :-).
Comment 5 Steve French 2016-11-15 18:55:02 UTC
Comment on attachment 12551 [details]
git-am fix for 4.4.x

Reviewed-by: Steve French <sfrench@samba.org>
Comment 6 Jeremy Allison 2016-11-15 19:36:22 UTC
Reassigning to Karolin for inclusion in 4.4.next.
Comment 7 Karolin Seeger 2016-11-16 07:30:49 UTC
(In reply to Jeremy Allison from comment #6)
Pushed to autobuild-v4-4-test.
Comment 8 Karolin Seeger 2016-11-17 07:47:33 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to v4-4-test.
Closing out bug report.

Thanks!