s3: smbd: have_file_open_below() fails to enumerate open files below an open director...
authorJeremy Allison <jra@samba.org>
Mon, 23 Nov 2015 22:00:56 +0000 (14:00 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 25 Nov 2015 11:22:52 +0000 (12:22 +0100)
commitfdac7f1f3854da3ed874781b1c03a4b776d4aa6e
tree241469e132f123a87057cde1138979ed12858b63
parent6f475357ce5a6310994bee70153c1d9267d1d81d
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 <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Michael Adam <obnox@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 <kseeger@samba.org>
Autobuild-Date(v4-2-test): Wed Nov 25 12:22:53 CET 2015 on sn-devel-104
source3/smbd/dir.c