From 2d6836a90bd326391782a5753f70e8ba666b5def Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Tue, 25 Sep 2012 04:27:38 -0400 Subject: SSH: Refactor sysdb and related code --- src/providers/ipa/ipa_hostid.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/providers/ipa/ipa_hostid.c') diff --git a/src/providers/ipa/ipa_hostid.c b/src/providers/ipa/ipa_hostid.c index c322c61f5..f85454ff6 100644 --- a/src/providers/ipa/ipa_hostid.c +++ b/src/providers/ipa/ipa_hostid.c @@ -246,6 +246,8 @@ hosts_get_done(struct tevent_req *subreq) struct hosts_get_state); int dp_error = DP_ERR_FATAL; errno_t ret; + struct sysdb_attrs *attrs; + time_t now = time(NULL); ret = ipa_host_info_recv(subreq, state, &state->count, &state->hosts, @@ -280,8 +282,20 @@ hosts_get_done(struct tevent_req *subreq) goto done; } - ret = sysdb_store_ssh_host(state->sysdb, state->name, state->alias, - state->hosts[0]); + attrs = sysdb_new_attrs(state); + if (!attrs) { + ret = ENOMEM; + goto done; + } + + /* we are interested only in the host keys */ + ret = sysdb_attrs_copy_values(state->hosts[0], attrs, SYSDB_SSH_PUBKEY); + if (ret != EOK) { + goto done; + } + + ret = sysdb_store_ssh_host(state->sysdb, state->name, state->alias, now, + attrs); if (ret != EOK) { goto done; } -- cgit