#9239 [Tracker] Nightly test failure (f37+) in test_trust.py::TestTrust::test_establish_forest_trust_with_shared_secret
Closed: fixed by frenaud. Opened by frenaud.

The nightly test test_trust.py::TestTrust::test_establish_forest_trust_with_shared_secret is failing in rawhide. See PR #2006 and PR #2026.

The test is failing when trying to establish the local side of the trust with:

Command '['powershell', '-c', '[System.DirectoryServices.ActiveDirectory.Forest]::getCurrentForest().CreateLocalSideOfTrustRelationship("ipa.test", 1, "qwertyuiopQq!1")']'

with the following error:

"A forest trust relationship exists between "ad.test" and "ipa.test"."

Indeed, there is already a trust established, because the first issue happens in the preceding test test_trust.py::TestTrust::test_remove_external_rootdomain_trust when it tries to delete the trust:

INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['rpcclient', '--use-kerberos=desired', 'ad-root.ad.test', '-c', 'deletetrustdom ipa.test']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd869:transport.py:513 RUN ['rpcclient', '--use-kerberos=desired', 'ad-root.ad.test', '-c', 'deletetrustdom ipa.test']
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd869:transport.py:557 Cannot connect to server.  Error was NT_STATUS_NOT_FOUND
DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd869:transport.py:217 Exit code: 1

The last successful run (PR #1967) was using samba-4.17.0-0.3.rc2.fc38.x86_64 and the failing run is using samba-4.17.0-0.8.rc3.fc38.

In order to reproduce:
Establish external trust to ad, then call rpcclient to remove the trust:

ipa trust-add --type ad ad.test --range-type ipa-ad-trust --external=True --admin Administrator@ad.test --password
kinit Administrator@AD.TEST
rpcclient --debuglevel 10 --debug-stdout --use-kerberos=desired root-dc.ad.test -c 'deletetrustdom testrelm.test'

The debug logs show that rpccbind is unable to resolve the server name:

[...]
internal_resolve_name: looking up � �U#20 (sitename (null))
convert_string_talloc_handle: Conversion error: Incomplete multibyte sequence
resolve_lmhosts: Attempting lmhosts lookup for name �   �U<0x20>
getlmhostsent: lmhost entry: 127.0.0.1 localhost 
resolve_wins: WINS server resolution selected and no WINS servers listed.
resolve_hosts: Attempting host lookup for name �    �U<0x20>
resolve_hosts: getaddrinfo failed for name �    �U [Name or service not known]
name_resolve_bcast: Attempting broadcast lookup for name �  �U<0x20>
convert_string_talloc_handle: Conversion error: Incomplete multibyte sequence
convert_string_handle: Conversion error: Incomplete multibyte sequence
tstream_unix_connect failed: No such file or directory
nmbd not around
Cannot connect to server.  Error was NT_STATUS_NOT_FOUND
msg_dgm_ref_destructor: refs=(nil)

On a working instance (fedora 36 for instance), the log is differnent:

internal_resolve_name: looking up root-dc.ad.test#20 (sitename (null))
namecache_fetch: name root-dc.ad.test#20 found.
remove_duplicate_addrs2: looking for duplicate address/port pairs
Connecting to 10.0.196.84 at port 445

It seems that the hostname is garbled with rpcclient 4.17.0. This command is provided with samba-client package, opening a BZ against samba / fedora 37 at https://bugzilla.redhat.com/show_bug.cgi?id=2133818

Metadata Update from @frenaud:
- Issue tagged with: tracker

samba issue has been fixed in fedora 37 with samba-4.17.1-1.fc37 (available in fedora repo) and rawhide with samba-4.17.1-1.fc38. Closing this ticket as done.

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata