Created attachment 8981 [details] log.samba.gz lsa_QueryInfoPolicy fails with NT_STATUS_NO_SUCH_DOMAIN if a second "CN=System" container exists.
Created attachment 8982 [details] testCase.py
Created attachment 8983 [details] 0001-s4-rpc_server-pick-CN-System-CriticalSystemObject.patch E.g. search '(&(objectClass=container)(cn=system)(isCriticalSystemObject=True))'
Confirmed. It almost took me a day to figure this out. Besides joining also login is affected on W2008/2012 machines.
Please consider the supplied patch for merge. We just had this again with samba 4.3.7, took a new colleague another day digging though network traces. For the record, these are the parts of log.samba characteristic for this situation: ============================================================================= [2016/08/10 15:00:50.317533, 1, pid=25834, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_function_debug) netr_DsrEnumerateDomainTrusts: struct netr_DsrEnumerateDomainTrusts in: struct netr_DsrEnumerateDomainTrusts server_name : * server_name : '\\somedc.domain.local' trust_flags : 0x0000003f (63) 1: NETR_TRUST_FLAG_IN_FOREST 1: NETR_TRUST_FLAG_OUTBOUND 1: NETR_TRUST_FLAG_TREEROOT 1: NETR_TRUST_FLAG_PRIMARY 1: NETR_TRUST_FLAG_NATIVE 1: NETR_TRUST_FLAG_INBOUND 0: NETR_TRUST_FLAG_MIT_KRB5 0: NETR_TRUST_FLAG_AES [...] [2016/08/10 15:00:50.329686, 10, pid=25834, effective(0, 0), real(0, 0), class=ldb] ../lib/ldb-samba/ldb_wrap.c:72(ldb_wrap_debug) ldb: ldb_trace_request: SEARCH dn: DC=domain,DC=local scope: sub expr: (&(objectClass=container)(cn=System)) attr: <ALL> control: <NONE> [...] [2016/08/10 15:00:50.331385, 1, pid=25834, effective(0, 0), real(0, 0)] ../librpc/ndr/ndr.c:439(ndr_print_function_debug) netr_DsrEnumerateDomainTrusts: struct netr_DsrEnumerateDomainTrusts out: struct netr_DsrEnumerateDomainTrusts trusts : * trusts: struct netr_DomainTrustList count : 0x00000000 (0) array : NULL result : WERR_GENERAL_FAILURE =============================================================================
(In reply to Arvid Requate from comment #4) Hi Arvid, I'd like to use CN=System,$DEFAULT_DN, instead of doing a search. We're using ldb_dn_add_child_fmt(system_dn, "CN=System"); in a few places already. See dsdb_trust_search_tdo[s](). Can you provide an updated patches? One for each subdirectory? Also remember we have two backupkey implementations now.
Created attachment 12413 [details] Bug-9959-master.patch Patch set for master
Created attachment 12414 [details] Bug-9959-v4-4-stable.patch Patch set for v4.4-stable
Created attachment 12415 [details] Bug-9959-v4-3-stable.patch Patch set for v4.3-stable
Created attachment 12884 [details] Bug-9959-v4-6-rc2.patch Updated patch.
Ideally I think this fix should actually not be needed because a second container called system should actually be forbidden be be created, see bug 14225.
Well, I don't know if things improved since reporting this bug, but at that time I experienced this issue. With 4.13.4 the test case (fixed for py3) doesn't show the issue any longer, apparently, two cn=system containers don't cause the issue downstream any longer: root@machine:~# python3 testCase.py =========================== Running lsa_QueryInfoPolicy Domain NetBios Name: DOM Domain Sid: S-1-5-21-2196904195-2995300023-2286668795 =========================== Creating container cn=system,cn=users,DC=dom,DC=tld =========================== Running lsa_QueryInfoPolicy again Domain NetBios Name: DOM Domain Sid: S-1-5-21-2196904195-2995300023-2286668795 =========================== Removing container cn=system,cn=users,DC=dom,DC=tld Yet, this shows that nothing prevents me from creating a container named system, nor a user for that matter: root@machine:~# samba-tool user create System Testpassword.1 User 'System' created successfully root@machine:~# ldbsearch -H /var/lib/samba/private/sam.ldb \ --controls=domain_scope:1 cn=system 1.1 # record 1 dn: CN=System,CN=Users,DC=dom,DC=tld # record 2 dn: CN=System,DC=dom,DC=tld # returned 2 records # 2 entries # 0 referrals Which may also conflict with the list of reserved words documented in https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou