s3:winbind: Do not use domain's private data to store the SAMR pipes
commit621b80645a47dc41b53217785b835706a1677468
authorSamuel Cabrero <scabrero@samba.org>
Wed, 13 Apr 2022 09:01:00 +0000 (13 11:01 +0200)
committerJule Anger <janger@samba.org>
Fri, 15 Apr 2022 13:46:10 +0000 (15 13:46 +0000)
tree26802d96613d170b74d211364b31ea471771cb61
parent41a2825ea5790296359aa069e19a55da7bf64be0
s3:winbind: Do not use domain's private data to store the SAMR pipes

The domain's private_data pointer is also used to store a ADS_STRUCT,
which is not allocated using talloc and there are many places casting
this pointer directly.

The recently added samba.tests.pam_winbind_setcred was randomly failing
and after debugging it the problem was that kerberos authentication was
failing because the time_offset passed to kerberos_return_pac() was
wrong. This time_offset was retrieved from ads->auth.time_offset, where
the ads pointer was directly casted from domain->private_data but
private_data was pointing to a winbind_internal_pipes struct.

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit e1f29b0970f4cac52a9cd517be6862cf69a1433a)
source3/winbindd/winbindd.h
source3/winbindd/winbindd_ndr.c
source3/winbindd/winbindd_samr.c