1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-22 18:22:12 +01:00

Merge pull request #1138 from dmach/0.x/fix-crash-.ssh-dir-missing

Fix crash in ssh auth when .ssh directory is missing
This commit is contained in:
Daniel Mach 2022-09-12 09:37:50 +02:00 committed by GitHub
commit 759537807c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -618,8 +618,12 @@ def _build_opener(apiurl):
return parts[1]
def list_ssh_dir_keys(self):
sshdir = os.path.expanduser('~/.ssh')
keys_in_home_ssh = {}
sshdir = os.path.expanduser('~/.ssh')
if not os.path.isdir(sshdir):
return keys_in_home_ssh
for keyfile in os.listdir(sshdir):
if keyfile.startswith(("agent-", "authorized_keys", "config", "known_hosts")):
# skip files that definitely don't contain keys