The branch, v4-2-test has been updated via fdac7f1 s3: smbd: have_file_open_below() fails to enumerate open files below an open directory handle. via 6f47535 wafsamba: Also build libraries with RELRO protection from 6033569 fix writev(vector[...]) points to uninitialised bytes in call_trans2findfirst
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test - Log ----------------------------------------------------------------- commit fdac7f1f3854da3ed874781b1c03a4b776d4aa6e Author: Jeremy Allison <j...@samba.org> Date: Mon Nov 23 14:00:56 2015 -0800 s3: smbd: have_file_open_below() fails to enumerate open files below an open directory handle. There are three issues: 1). The memcmp checking that the open file path has the open directory path as its parent compares using the wrong length (it uses the full open file path which will never compare as the same). 2). The files_below_forall() function doesn't fill in the callback function or callback data when calling share_mode_forall(), leading to a crash (which we never saw, as the previous issue (1) meant the callback function would never be invoked). 3). When invoking the callback function from files_below_forall_fn() we were passing in the wrong private_data pointer (needs to be the one from the state, not the private_data passed into files_below_forall_fn()). Found when running the torture test smb2.rename.rename_dir_openfile when fixing bug #11065. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11615 Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> Autobuild-User(master): Michael Adam <ob...@samba.org> Autobuild-Date(master): Tue Nov 24 19:36:20 CET 2015 on sn-devel-104 (cherry picked from commit 158200611271bd80d80280c88578dfd5380f8fd0) Autobuild-User(v4-2-test): Karolin Seeger <ksee...@samba.org> Autobuild-Date(v4-2-test): Wed Nov 25 12:22:53 CET 2015 on sn-devel-104 commit 6f475357ce5a6310994bee70153c1d9267d1d81d Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 19 09:28:32 2015 +0200 wafsamba: Also build libraries with RELRO protection BUG: https://bugzilla.samba.org/show_bug.cgi?id=11346 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Guenther Deschner <g...@samba.org> (cherry picked from commit 893b5f81441bbc98ef403855ec8e2e39569479d2) ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/wafsamba.py | 2 ++ source3/smbd/dir.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 188e535..39d9605 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -239,6 +239,8 @@ def SAMBA_LIBRARY(bld, libname, source, bundled_extension, private_library) ldflags = TO_LIST(ldflags) + if bld.env['ENABLE_RELRO'] is True: + ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now')) features = 'cc cshlib symlink_lib install_lib' if pyext: diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 5ec9cc3..55313db 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1905,14 +1905,14 @@ static int files_below_forall_fn(struct file_id fid, return 0; } - if (memcmp(state->dirpath, fullpath, len) != 0) { + if (memcmp(state->dirpath, fullpath, state->dirpath_len) != 0) { /* * Not a parent */ return 0; } - return state->fn(fid, data, private_data); + return state->fn(fid, data, state->private_data); } static int files_below_forall(connection_struct *conn, @@ -1922,7 +1922,10 @@ static int files_below_forall(connection_struct *conn, void *private_data), void *private_data) { - struct files_below_forall_state state = {}; + struct files_below_forall_state state = { + .fn = fn, + .private_data = private_data, + }; int ret; char tmpbuf[PATH_MAX]; char *to_free; @@ -1957,7 +1960,9 @@ static int have_file_open_below_fn(struct file_id fid, static bool have_file_open_below(connection_struct *conn, const struct smb_filename *name) { - struct have_file_open_below_state state = {}; + struct have_file_open_below_state state = { + .found_one = false, + }; int ret; if (!VALID_STAT(name->st)) { -- Samba Shared Repository