From 748ba184db97b7534254f97018fa04e8aa458fae Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Sun, 26 Feb 2012 13:24:16 -0500 Subject: SSH: Refactor responder and client common code --- src/sss_client/ssh/sss_ssh_knownhostsproxy.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/sss_client/ssh/sss_ssh_knownhostsproxy.c') diff --git a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c index b95dbe8e..fb93e4ad 100644 --- a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c +++ b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c @@ -33,9 +33,10 @@ #include "util/util.h" #include "util/crypto/sss_crypto.h" +#include "util/sss_ssh.h" #include "tools/tools_util.h" #include "sss_client/sss_cli.h" -#include "sss_client/ssh/sss_ssh.h" +#include "sss_client/ssh/sss_ssh_client.h" #define DEFAULT_FILE ".ssh/sss_known_hosts" @@ -247,8 +248,8 @@ int main(int argc, const char **argv) const char *host; FILE *f; struct addrinfo ai_hint, *ai = NULL; - struct sss_ssh_pubkey *pubkeys; - size_t num_pubkeys, i; + struct sss_ssh_ent *ent; + size_t i; char *repr; int ret; @@ -345,11 +346,8 @@ int main(int argc, const char **argv) } /* look up public keys */ - ret = sss_ssh_get_pubkeys(mem_ctx, SSS_SSH_GET_HOST_PUBKEYS, host, - &pubkeys, &num_pubkeys); + ret = sss_ssh_get_ent(mem_ctx, SSS_SSH_GET_HOST_PUBKEYS, host, &ent); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, - ("sss_ssh_get_pubkeys failed() (%d): %s\n", ret, strerror(ret))); ERROR("Error looking up public keys\n"); ret = EXIT_FAILURE; goto fini; @@ -370,13 +368,10 @@ int main(int argc, const char **argv) fprintf(f, "# Generated by sss_ssh_knownhostsproxy. Please do not modify.\n"); - for (i = 0; i < num_pubkeys; i++) { - ret = sss_ssh_format_pubkey(mem_ctx, &pubkeys[i], - SSS_SSH_FORMAT_OPENSSH, &repr); - if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, - ("sss_ssh_format_pubkey() failed (%d): %s\n", - ret, strerror(ret))); + for (i = 0; i < ent->num_pubkeys; i++) { + repr = sss_ssh_format_pubkey(mem_ctx, ent, &ent->pubkeys[i], + SSS_SSH_FORMAT_OPENSSH); + if (!repr) { continue; } -- cgit