s3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lo...
commit3d5ae093e3ecebf620569bdcd7f7232fc260b460
authorJeremy Allison <jra@samba.org>
Fri, 28 Feb 2014 00:19:53 +0000 (27 16:19 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 10 Mar 2014 15:33:24 +0000 (10 16:33 +0100)
tree7a917596ead602d83f0c0289c2dc5d6485dd1fdf
parentc62eec5f51fd43767bb55173ee51175e13722448
s3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lock even if there are no locks.

brl_get_locks_internal() currently returns NULL when it can't
find any byte range locks on the file. This is an error - it
should return a valid struct byte_range_lock containing num_locks == 0
so it can be cached.

Returning NULL when there are no locks causes POSIX lock
tests to fail returning NT_STATUS_NO_MEMORY (as it thinks
it can't allocate the struct) instead of NT_STATUS_OK.

This is a back-port of git commit abf08ed544ce05ea5a6e6ea2e531b6a2d97e15cc
that went into master.

Fixes bug:

Bug 10431 - STATUS_NO_MEMORY response from Query File Posix Lock request

https://bugzilla.samba.org/show_bug.cgi?id=10431

Signed-off-by: Jeremy Allison <jra@samba.org>
source3/locking/brlock.c