Missing talloc_steal in winbindd_list_users_recv (Re: winbind: Remove wbint_QueryUserList?)

Stefan Metzmacher metze at samba.org
Tue Jan 10 08:54:33 UTC 2017


Am 10.01.2017 um 09:21 schrieb Stefan Metzmacher:
> Am 10.01.2017 um 08:50 schrieb Stefan Metzmacher:
>> Am 10.01.2017 um 05:36 schrieb Andrew Bartlett:
>>> On Tue, 2017-01-10 at 13:09 +1300, Andrew Bartlett wrote:
>>>> On Tue, 2017-01-10 at 12:33 +1300, Andrew Bartlett wrote:
>>>>>
>>>>> So far I've not seen 479ce28fd7dd54a6ae76fbbe3cd0a870738d87c0 fail
>>>>> with
>>>>> this error code, so there may be something quite fishy going on.
>>>>
>>>> OK, now 479ce28fd7dd54a6ae76fbbe3cd0a870738d87c0 has failed, so we
>>>> can
>>>> stop the X-Files theme track and presume it is something in that
>>>> patch.
>>>>  It also just makes much more sense.
>>>>
>>>> Andrew Bartlett
>>>
>>> I've run a number of builds, and so far the first reliable commit (for
>>> this particular failure) is 81e5770, that is the previous commit to the
>>> above.  I suggest a careful investigation of
>>> 479ce28fd7dd54a6ae76fbbe3cd0a870738d87c0 or if that isn't productive, a
>>> revert to 81e5770.  The patches up to that seem fine (as you would
>>> expect, as this is the main commit making changes). 
>>>
>>> I'm hoping this information is of assistance, and I'll let you know if
>>> it changes (ie, I get these failures for 81e5770).
>>
>> I run two autobuild loops on sn-devel-144 for a day using
>> 0127bdd33b251a52c6ffc44b6cb3b82b16a80741 with this on top
>>
>> diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
>> index ec07106..3ce758f 100755
>> --- a/source4/selftest/tests.py
>> +++ b/source4/selftest/tests.py
>> @@ -709,7 +709,7 @@ for env in ['vampire_dc', 'promoted_dc']:
>>  planoldpythontestsuite("chgdcpass:local",
>> "samba.tests.blackbox.samba_dnsupdate",
>>                         environ={'DNS_SERVER_IP': '$SERVER_IP'})
>>
>> -for env in ["ad_dc_ntvfs", "s4member", "rodc", "promoted_dc", "ad_dc",
>> "ad_member"]:
>> +for env in ["ad_dc_ntvfs", "rodc", "promoted_dc", "ad_dc", "ad_member"]:
>>      plantestsuite("samba.blackbox.wbinfo(%s:local)" % env, "%s:local" %
>> env, [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"),
>> '$DOMAIN', '$DC_US
>>
>>  #
>>
>> So far I got the following two related failures:
>>
>> [2003(13901)/2027 at 3h14m29s] samba.blackbox.wbinfo(ad_dc_ntvfs:local)
>> [2004(13943)/2027 at 3h14m31s] samba.blackbox.wbinfo(rodc:local)
>> [2005(13985)/2027 at 3h14m34s] samba.blackbox.wbinfo(promoted_dc:local)
>> [2006(14027)/2027 at 3h14m36s] samba.blackbox.wbinfo(ad_dc:local)
>> [2007(14069)/2027 at 3h14m38s] samba.blackbox.wbinfo(ad_member:local)
>> UNEXPECTED(failure): samba.blackbox.wbinfo(ad_member:local).wbinfo -u
>> against ad_member(ad_member:local)
>> REASON: Exception: Exception: Error looking up domain users
>>
>> FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites)
>>
>>
>> And this:
>>
>> [1827(11257)/2028 at 1h53m34s]
>> samba.wbinfo_simple.(ad_member:local).--domain-users
>> UNEXPECTED(failure):
>> samba.wbinfo_simple.(ad_member:local).--domain-users.wbinfo(ad_member:local)
>> REASON: Exception: Exception: Error looking up domain users
>>
>> So it seems it's not just the s4member environment but also the
>> ad_member one.
>> ad_member is a normal member server in the ad_dc_ntvfs environment.
> 
> Ok, running the following locally also triggers it with nt4_member in
> some cases.
> 
> Also adding
> diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
> index 80b245a..9b0e89f 100644
> --- a/nsswitch/wbinfo.c
> +++ b/nsswitch/wbinfo.c
> @@ -2094,6 +2094,7 @@ static bool print_domain_users(const char *domain)
> 
>         wbc_status = wbcListUsers(domain, &num_users, &users);
>         if (!WBC_ERROR_IS_OK(wbc_status)) {
> +               d_printf("%s:%s: %s\n", __location__, __func__,
> wbcErrorString(wbc_status));
>                 return false;
>         }
> 
> Gives me
> 
> [2(1)/6 at 5s]
> samba.wbinfo_simple.(nt4_member:local).--domain-users(nt4_member:local)
> UNEXPECTED(failure):
> samba.wbinfo_simple.(nt4_member:local).--domain-users.wbinfo(nt4_member:local)
> REASON: Exception: Exception: Error looking up domain users
> ../nsswitch/wbinfo.c:2097:print_domain_users: WBC_ERR_INVALID_RESPONSE
> 
> It seems to be this check in wbcCtxListUsers()
> 
>         if (num_users != response.data.num_entries) {
>                 wbc_status = WBC_ERR_INVALID_RESPONSE;
>                 printf("%s:%s: %s %u != %u\n", __location__, __func__,
> wbcErrorString(wbc_status),
>                         (unsigned)num_users,
> (unsigned)response.data.num_entries);
>                 goto done;
>         }
> 
> I got 1 != 5.

With more output I got

09:40 < metze>
metze:../nsswitch/libwbclient/wbc_sid.c:890:wbcCtxListUsers:
response.data.num_entries[5] extra[]
09:40 < metze>
metze:../nsswitch/libwbclient/wbc_sid.c:915:wbcCtxListUsers:
current[0ok:+] next[(nil)] num_users[1]
09:40 < metze>
metze:../nsswitch/libwbclient/wbc_sid.c:920:wbcCtxListUsers:
WBC_ERR_INVALID_RESPONSE 1 != 5
09:40 < metze> ../nsswitch/wbinfo.c:2097:print_domain_users:
WBC_ERR_INVALID_RESPONSE

While the printing result in winbindd_list_users_recv() shows some sane.

The attached patch should fix the problem.

I'll push this shortly.

Thanks!
metze
-------------- next part --------------
From cd50ca22375223df2bee13832472f7b22b145f01 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 10 Jan 2017 09:48:33 +0100
Subject: [PATCH] s3:winbindd: talloc_steal the extra_data in
 winbindd_list_users_recv()

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

Pair-Programmed-With: Andreas Schneider <asn at samba.org>

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/winbindd/winbindd_list_users.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd_list_users.c b/source3/winbindd/winbindd_list_users.c
index 4a4343e..9a751a7 100644
--- a/source3/winbindd/winbindd_list_users.c
+++ b/source3/winbindd/winbindd_list_users.c
@@ -174,7 +174,7 @@ NTSTATUS winbindd_list_users_recv(struct tevent_req *req,
 
 	len = talloc_get_size(result);
 
-	response->extra_data.data = result;
+	response->extra_data.data = talloc_steal(response, result);
 	response->length += len;
 	response->data.num_entries = 0;
 
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170110/33d0542d/signature.sig>


More information about the samba-technical mailing list