Skip to content

Commit 46d3fb9

Browse files
committed
fix handling of 'none'
1 parent b9a54f6 commit 46d3fb9

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

pymongo/asynchronous/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _auth_key(nonce: str, username: str, password: str) -> str:
180180
def _canonicalize_hostname(hostname: str, option: str | bool) -> str:
181181
"""Canonicalize hostname following MIT-krb5 behavior."""
182182
# https://github.com/krb5/krb5/blob/d406afa363554097ac48646a29249c04f498c88e/src/util/k5test.py#L505-L520
183-
if option in [False, None]:
183+
if option in [False, "none"]:
184184
return hostname
185185

186186
af, socktype, proto, canonname, sockaddr = socket.getaddrinfo(

pymongo/auth_shared.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ def __hash__(self) -> int:
8989

9090
def _validate_canonicalize_host_name(value: str | bool) -> str | bool:
9191
valid_names = [False, True, "none", "forward", "forwardAndReverse"]
92-
if value == "none":
93-
value = False
9492
if value in ["true", "false", True, False]:
9593
return value in ["true", True]
9694

pymongo/synchronous/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _auth_key(nonce: str, username: str, password: str) -> str:
177177
def _canonicalize_hostname(hostname: str, option: str | bool) -> str:
178178
"""Canonicalize hostname following MIT-krb5 behavior."""
179179
# https://github.com/krb5/krb5/blob/d406afa363554097ac48646a29249c04f498c88e/src/util/k5test.py#L505-L520
180-
if option in [False, None]:
180+
if option in [False, "none"]:
181181
return hostname
182182

183183
af, socktype, proto, canonname, sockaddr = socket.getaddrinfo(

0 commit comments

Comments
 (0)