Bug 14865 - uncached logon on RODC always fails once
Summary: uncached logon on RODC always fails once
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.15.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL: https://gitlab.com/samba-team/samba/-...
Keywords:
Depends on:
Blocks: 13377
  Show dependency treegraph
 
Reported: 2021-10-14 07:52 UTC by Björn Jacke
Modified: 2022-04-26 14:44 UTC (History)
4 users (show)

See Also:


Attachments
Patches for v4-16-test (35.85 KB, patch)
2022-03-07 18:53 UTC, Stefan Metzmacher
metze: review? (abartlet)
jsutton: review+
Details
Patches for v4-15-test (7.52 KB, patch)
2022-03-08 17:03 UTC, Stefan Metzmacher
no flags Details
Patches for v4-14-test (7.52 KB, patch)
2022-03-08 17:04 UTC, Stefan Metzmacher
no flags Details
Patches for v4-15-test (7.54 KB, text/plain)
2022-03-15 09:32 UTC, Stefan Metzmacher
abartlet: review+
Details
Patches for v4-14-test (7.54 KB, patch)
2022-03-15 09:32 UTC, Stefan Metzmacher
abartlet: review+
Details
Patches for v4-15-test (7.55 KB, patch)
2022-03-17 07:42 UTC, Stefan Metzmacher
metze: review? (abartlet)
jsutton: review+
asn: review+
Details
Patches for v4-14-test (7.55 KB, patch)
2022-03-17 07:43 UTC, Stefan Metzmacher
metze: review? (abartlet)
jsutton: review+
asn: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Jacke 2021-10-14 07:52:00 UTC
if a password of a user is not yet cached on a RODC, then the login fails, even if a RWDC is reachable. The password is being cached after that though and subsequent logins will are successfull then. I guess this is not the intended behaviour?
Comment 1 Samba QA Contact 2022-03-07 00:01:06 UTC
This bug was referenced in samba master:

f33f73f82fb2d5d96928ce5910e2d0d939c2ff57
27ee5ad713b760e8226537d79c529ace1efb07bf
0f5d7ff1a9fd14fd412b09883d413d1d660fa7be
Comment 2 Stefan Metzmacher 2022-03-07 18:53:05 UTC
Created attachment 17193 [details]
Patches for v4-16-test
Comment 3 Andrew Bartlett 2022-03-07 21:13:56 UTC
There is an oss-fuzz build failure that should be addressed first if possible.

https://oss-fuzz-build-logs.storage.googleapis.com/log-426d78f2-f4db-4448-a337-90a6e48741cc.txt
Comment 4 Stefan Metzmacher 2022-03-08 12:44:36 UTC
(In reply to Andrew Bartlett from comment #3)

The warning was introduced by this commit:

https://git.samba.org/?p=samba.git;a=commitdiff;h=1201147d06feeba8b6ec72fb537340ba29b1b95f

commit 1201147d06feeba8b6ec72fb537340ba29b1b95f
Author:     Andreas Schneider <asn@samba.org>
AuthorDate: Thu Dec 9 07:48:13 2021 +0100
Commit:     Andreas Schneider <asn@cryptomilk.org>
CommitDate: Fri Mar 4 14:05:31 2022 +0000

    s4:kdc: Implement new Microsoft forwardable flag behavior
    
    Allow delegation to any target if we have delegations set up, but the target is
    not specified.
    
    Signed-off-by: Andreas Schneider <asn@samba.org>
    Reviewed-by: Stefan Metzmacher <metze@samba.org>

And that's not related to this bug report.

I'll also upload backports for 4.15 and 4.14 in the next days,
but it can be pushed to 4.16 now.
Comment 5 Samba QA Contact 2022-03-08 14:31:08 UTC
This bug was referenced in samba v4-16-test:

302f9acb4a0c689a572b157f4947333485d05724
b8e20583b052aeb8f1bda381f7a0dab420325e8d
4b6a6af868c03407d41dd978e8a72b1acbc87720
Comment 6 Jule Anger 2022-03-08 14:43:01 UTC
Re-assigning to Metze.
Comment 7 Samba QA Contact 2022-03-08 15:25:42 UTC
This bug was referenced in samba v4-16-stable (Release samba-4.16.0rc5):

302f9acb4a0c689a572b157f4947333485d05724
b8e20583b052aeb8f1bda381f7a0dab420325e8d
4b6a6af868c03407d41dd978e8a72b1acbc87720
Comment 8 Stefan Metzmacher 2022-03-08 17:03:50 UTC
Created attachment 17196 [details]
Patches for v4-15-test
Comment 9 Stefan Metzmacher 2022-03-08 17:04:11 UTC
Created attachment 17197 [details]
Patches for v4-14-test
Comment 10 Jo Sutton 2022-03-11 05:37:11 UTC
Comment on attachment 17196 [details]
Patches for v4-15-test

In the first commit, 'str' should probably be freed in the HDB_ERR_NOT_FOUND_HERE case.

Also, in the second commit, final_ret should be initialised to 0.
Comment 11 Stefan Metzmacher 2022-03-15 09:24:34 UTC
Comment on attachment 17196 [details]
Patches for v4-15-test

The backport left final_ret uninitialized
Comment 12 Stefan Metzmacher 2022-03-15 09:25:15 UTC
Comment on attachment 17197 [details]
Patches for v4-14-test

The backport left final_ret uninitialized...
Comment 13 Stefan Metzmacher 2022-03-15 09:32:22 UTC
Created attachment 17212 [details]
Patches for v4-15-test
Comment 14 Stefan Metzmacher 2022-03-15 09:32:43 UTC
Created attachment 17213 [details]
Patches for v4-14-test
Comment 15 Andrew Bartlett 2022-03-15 20:58:10 UTC
I love how simple this ended up, even for the backport. 

Assigning to Jule for 4.14 and 4.15
Comment 16 Jo Sutton 2022-03-15 21:19:52 UTC
For 4.15 and 4.16, don't we have a leak if 'str' isn't freed after calling clientdb->hdb_auth_status()? Anyway, it's only a minor thing.
Comment 17 Stefan Metzmacher 2022-03-17 07:38:17 UTC
Comment on attachment 17212 [details]
Patches for v4-15-test

Yes, we should free str
Comment 18 Stefan Metzmacher 2022-03-17 07:42:40 UTC
Created attachment 17225 [details]
Patches for v4-15-test
Comment 19 Stefan Metzmacher 2022-03-17 07:43:18 UTC
Created attachment 17226 [details]
Patches for v4-14-test
Comment 20 Samba QA Contact 2022-03-18 11:56:04 UTC
This bug was referenced in samba v4-14-test:

68f55294eb0c37da3c4e3f76d5c3154e762d46ad
1a1b789b2fe6672604f2e2f5c5e7a30f5a1c90a2
Comment 21 Samba QA Contact 2022-03-19 02:39:03 UTC
This bug was referenced in samba v4-15-test:

5aa5648cc4b0497a000c31e8b40cdaaa6c18769e
b4d5a906df8b23363365559e31887403bace1482
Comment 22 Samba QA Contact 2022-04-04 12:50:54 UTC
This bug was referenced in samba v4-14-stable (Release samba-4.14.13):

68f55294eb0c37da3c4e3f76d5c3154e762d46ad
1a1b789b2fe6672604f2e2f5c5e7a30f5a1c90a2
Comment 23 Samba QA Contact 2022-04-26 14:44:25 UTC
This bug was referenced in samba v4-15-stable (Release samba-4.15.7):

5aa5648cc4b0497a000c31e8b40cdaaa6c18769e
b4d5a906df8b23363365559e31887403bace1482