Skip to content

Commit

Permalink
avoid KeyError when canonicaldomains is missing
Browse files Browse the repository at this point in the history
paramiko assumes that `canonicaldomains` is always present when `CanonicalizeHostname` is set, and it errors out when it is not, preventing the whole host config from being parsed.

Xpra-org/xpra#3868 (comment)
  • Loading branch information
totaam committed Jul 20, 2023
1 parent 56f3c16 commit 1e50709
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion paramiko/config.py
Expand Up @@ -231,7 +231,7 @@ def lookup(self, hostname):
if canon and hostname.count(".") <= maxdots:
# NOTE: OpenSSH manpage does not explicitly state this, but its
# implementation for CanonicalDomains is 'split on any whitespace'.
domains = options["canonicaldomains"].split()
domains = options.get("canonicaldomains", "").split()
hostname = self.canonicalize(hostname, options, domains)
# Overwrite HostName again here (this is also what OpenSSH does)
options["hostname"] = hostname
Expand Down

1 comment on commit 1e50709

@totaam
Copy link
Author

@totaam totaam commented on 1e50709 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted to a PR here: #2338

Please sign in to comment.