Skip to content

Commit

Permalink
ipaserver/dcerpc: avoid logging stack trace in retrieve_anonymously
Browse files Browse the repository at this point in the history
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 <rjeffman@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
  • Loading branch information
rjeffman authored and flo-renaud committed Nov 27, 2023
1 parent 5e17c13 commit 60fe752
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ipaserver/dcerpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,12 @@ def retrieve_anonymously(self, remote_host,
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
Expand Down

0 comments on commit 60fe752

Please sign in to comment.