Skip to content

Commit dacdbf7

Browse files
committed
Validate each return host in nodes
1 parent 531e9c9 commit dacdbf7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

pymongo/asynchronous/srv_resolver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ async def _get_srv_response_and_hosts(
136136
]
137137

138138
# Validate hosts
139-
srv_host = results[0].target.to_text()
140139
for node in nodes:
141-
if self.__fqdn == srv_host:
140+
if self.__fqdn == node[0].lower():
142141
raise ConfigurationError(
143142
"Invalid SRV host: return address is identical to SRV hostname"
144143
)

pymongo/synchronous/srv_resolver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,8 @@ def _get_srv_response_and_hosts(
136136
]
137137

138138
# Validate hosts
139-
srv_host = results[0].target.to_text()
140139
for node in nodes:
141-
if self.__fqdn == srv_host:
140+
if self.__fqdn == node[0].lower():
142141
raise ConfigurationError(
143142
"Invalid SRV host: return address is identical to SRV hostname"
144143
)

0 commit comments

Comments
 (0)