File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,19 @@ async def _get_srv_response_and_hosts(
129129 ) -> tuple [resolver .Answer , list [tuple [str , Any ]]]:
130130 results = await self ._resolve_uri (encapsulate_errors )
131131
132- if self .__fqdn == results [0 ].target .to_text ():
133- raise ConfigurationError (
134- "Invalid SRV host: return address is identical to SRV hostname"
135- )
136-
137132 # Construct address tuples
138133 nodes = [
139134 (maybe_decode (res .target .to_text (omit_final_dot = True )), res .port ) # type: ignore[attr-defined]
140135 for res in results
141136 ]
142137
143138 # Validate hosts
139+ srv_host = results [0 ].target .to_text ()
144140 for node in nodes :
141+ if self .__fqdn == srv_host :
142+ raise ConfigurationError (
143+ "Invalid SRV host: return address is identical to SRV hostname"
144+ )
145145 try :
146146 nlist = node [0 ].lower ().split ("." )[1 :][- self .__slen :]
147147 except Exception :
Original file line number Diff line number Diff line change @@ -129,19 +129,19 @@ def _get_srv_response_and_hosts(
129129 ) -> tuple [resolver .Answer , list [tuple [str , Any ]]]:
130130 results = self ._resolve_uri (encapsulate_errors )
131131
132- if self .__fqdn == results [0 ].target .to_text ():
133- raise ConfigurationError (
134- "Invalid SRV host: return address is identical to SRV hostname"
135- )
136-
137132 # Construct address tuples
138133 nodes = [
139134 (maybe_decode (res .target .to_text (omit_final_dot = True )), res .port ) # type: ignore[attr-defined]
140135 for res in results
141136 ]
142137
143138 # Validate hosts
139+ srv_host = results [0 ].target .to_text ()
144140 for node in nodes :
141+ if self .__fqdn == srv_host :
142+ raise ConfigurationError (
143+ "Invalid SRV host: return address is identical to SRV hostname"
144+ )
145145 try :
146146 nlist = node [0 ].lower ().split ("." )[1 :][- self .__slen :]
147147 except Exception :
You can’t perform that action at this time.
0 commit comments