s3: rpc_server: Avoid creating new handles when received an empty policy_handle
authorSamuel Cabrero <scabrero@suse.de>
Thu, 16 Sep 2021 12:08:28 +0000 (14:08 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 20 Sep 2021 14:31:33 +0000 (14:31 +0000)
commit8a93ef625fd348c1473c7a55bff480de05bdaf77
tree3321157304d0b1b02c9fd0ba3d472e226d0e5011
parentcf4a868be50e795889b76b59f7fbe1cca51bcbfa
s3: rpc_server: Avoid creating new handles when received an empty policy_handle

After merging s3 and s4 RPC handles implementations in commit
70fa7e817e48c9faa3c6c7ae3749e4a8ebf3e6c2 a new empty handle is allocated
when find_policy_by_hnd() or close_policy_hnd() is called with an empty
policy_handle (see dcesrv_handle_lookup() implementation).

This new behavior was causing a crash when running samba3.rpc.mdssvc test
with log level >= 10, because a debug message in _mdssvc_close() was
dereferencing the handle's associated data when called from
test_mdssvc_close() with an empty policy_handle.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep 20 14:31:33 UTC 2021 on sn-devel-184
source3/rpc_server/rpc_handles.c