From 60fe752da468e84a642af51090b27468446606f7 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Wed, 22 Nov 2023 15:03:37 -0300 Subject: [PATCH] ipaserver/dcerpc: avoid logging stack trace in retrieve_anonymously If an error occured when searching foc a DC a stack trace was logged, and execution was aborted. This patch allows execution to continue and log the error message that caused the 'finddc' do fail. Fixes: https://pagure.io/freeipa/issue/9484 Related: https://issues.redhat.com/browse/RHEL-12149 Signed-off-by: Rafael Guterres Jeffman Reviewed-By: Alexander Bokovoy --- ipaserver/dcerpc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index 675572c03..ed9f0c046 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -935,7 +935,12 @@ class TrustDomainInstance: else: result = netrc.finddc(address=remote_host, flags=flags) except RuntimeError as e: - raise assess_dcerpc_error(e) + dcerpc_error = assess_dcerpc_error(e) + logger.error( + getattr(dcerpc_error, "info", None) + or getattr(dcerpc_error, "reason", str(dcerpc_error)) + ) + return False if not result: return False