Reported by Clemens Brunner: When passing a domain-qualified username like DOMAIN\user or DOMAIN/user to smbc_set_credentials_with_fallback(), the domain prefix was previously stored as part of the username. This caused authentication failures on DFS shares where the target server is different from the entry-point server, because those connections use the context-level credentials directly and would try to authenticate as the literal string DOMAIN\user with no domain set. I've stumbled upon this behavior using Dolphin (with the Samba part in KIO-Extras) and initially tried to fix it there (https://invent.kde.org/network/kio-extras/-/merge_requests/517), but I think the fix belongs here. This patch splits the username on \, /, or the configured winbind separator, storing the domain and username in their respective credential fields (this mirrors what cli_session_creds_init() already does for initial connections). If the caller explicitly supplied a non-default workgroup, that value takes precedence over any domain embedded in the username.
This bug was referenced in samba master: c12c825708a05918c5ee28bd127881ec5fb0aa38 40b8d8c221258e8db10426a43ff57caacd5d48b0
Created attachment 19035 [details] patch for 4.24 and 4.23
Comment on attachment 19035 [details] patch for 4.24 and 4.23 applies cleanly on 4.23 & 4.24 (and tests pass)
assigning to release for inclusion in 4.23/4.24
This bug was referenced in samba v4-24-test: 0d4c67d01f827cd1f0dcea7e68d665bc3cdeb798 db4b1bf2a9fb7ae12a1b620248ea5c627858176f
This bug was referenced in samba v4-24-stable (Release samba-4.24.4): 0d4c67d01f827cd1f0dcea7e68d665bc3cdeb798 db4b1bf2a9fb7ae12a1b620248ea5c627858176f