Bug 16149 - domain\user not split when provided as username in smbc_set_credentials_with_fallback()
Summary: domain\user not split when provided as username in smbc_set_credentials_with_...
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.24.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-06-25 08:28 UTC by Andreas Schneider
Modified: 2026-07-13 07:02 UTC (History)
3 users (show)

See Also:


Attachments
patch for 4.24 and 4.23 (7.66 KB, patch)
2026-06-25 12:31 UTC, Andreas Schneider
pfilipensky: review+
npower: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2026-06-25 08:28:28 UTC
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.
Comment 1 Samba QA Contact 2026-06-25 12:20:04 UTC
This bug was referenced in samba master:

c12c825708a05918c5ee28bd127881ec5fb0aa38
40b8d8c221258e8db10426a43ff57caacd5d48b0
Comment 2 Andreas Schneider 2026-06-25 12:31:42 UTC
Created attachment 19035 [details]
patch for 4.24 and 4.23
Comment 3 Noel Power 2026-06-25 14:54:19 UTC
Comment on attachment 19035 [details]
patch for 4.24 and 4.23

applies cleanly on 4.23 & 4.24 (and tests pass)
Comment 4 Noel Power 2026-06-25 14:55:32 UTC
assigning to release for inclusion in 4.23/4.24
Comment 5 Samba QA Contact 2026-06-25 20:53:03 UTC
This bug was referenced in samba v4-24-test:

0d4c67d01f827cd1f0dcea7e68d665bc3cdeb798
db4b1bf2a9fb7ae12a1b620248ea5c627858176f
Comment 6 Samba QA Contact 2026-06-30 19:44:11 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.4):

0d4c67d01f827cd1f0dcea7e68d665bc3cdeb798
db4b1bf2a9fb7ae12a1b620248ea5c627858176f