Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH: sss_ssh_knownhosts must ignore DNS errors #7670

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/db/sysdb_ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,14 @@ sysdb_get_ssh_host(TALLOC_CTX *mem_ctx,
return ENOMEM;
}

filter = talloc_asprintf(tmp_ctx, "(%s=%s)", SYSDB_NAME, name);
filter = talloc_asprintf(tmp_ctx, "(|(%s=%s)(%s=%s))",
SYSDB_NAME, name, SYSDB_NAME_ALIAS, name);
if (!filter) {
ret = ENOMEM;
goto done;
}

DEBUG(SSSDBG_TRACE_INTERNAL, "Searching sysdb with filter '%s'\n", filter);
ret = sysdb_search_ssh_hosts(tmp_ctx, domain, filter, attrs,
&num_hosts, &hosts);
if (ret != EOK) {
Expand Down
5 changes: 4 additions & 1 deletion src/providers/ldap/sdap_async_hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ sdap_host_info_send(TALLOC_CTX *mem_ctx,
state->host_filter = talloc_asprintf(state, "(objectClass=%s)",
host_map[SDAP_OC_HOST].name);
} else {
state->host_filter = talloc_asprintf(state, "(&(objectClass=%s)(%s=%s))",
state->host_filter = talloc_asprintf(state,
"(&(objectClass=%s)(|(%s=%s)(%s=%s)))",
host_map[SDAP_OC_HOST].name,
host_map[SDAP_AT_HOST_FQDN].name,
hostname,
host_map[SDAP_AT_HOST_SERVERHOSTNAME].name,
hostname);
}
if (state->host_filter == NULL) {
Expand Down
6 changes: 3 additions & 3 deletions src/sss_client/ssh/sss_ssh_knownhosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static errno_t known_hosts(TALLOC_CTX *mem_ctx, const char *domain,
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
"getaddrinfo() failed (%d): %s\n", ret, gai_strerror(ret));
goto done;
canonname = host;
} else {
canonname = ai->ai_canonname;
}
Expand All @@ -128,12 +128,12 @@ static errno_t known_hosts(TALLOC_CTX *mem_ctx, const char *domain,
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
"getnameinfo() failed (%d): %s\n", ret, gai_strerror(ret));
goto done;
canonname = host;
} else {
canonname = canonhost;
}
}
DEBUG(SSSDBG_FUNC_DATA, "Found canonical name: %s\n", canonname);
DEBUG(SSSDBG_FUNC_DATA, "Looking for name: %s\n", canonname);

/* look up public keys */
ret = sss_ssh_get_ent(mem_ctx, SSS_SSH_GET_HOST_PUBKEYS,
Expand Down
Loading