summaryrefslogtreecommitdiffstats
path: root/src/providers/ipa
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-09-25 04:27:38 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-10-05 10:51:54 +0200
commit2d6836a90bd326391782a5753f70e8ba666b5def (patch)
treeb69421bd93196be2779fe58684c5f6b8a1a90496 /src/providers/ipa
parent67ca9e7c006d8619f446c018eabf29eab1368ba5 (diff)
downloadsssd-2d6836a90bd326391782a5753f70e8ba666b5def.tar.gz
sssd-2d6836a90bd326391782a5753f70e8ba666b5def.tar.xz
sssd-2d6836a90bd326391782a5753f70e8ba666b5def.zip
SSH: Refactor sysdb and related code
Diffstat (limited to 'src/providers/ipa')
-rw-r--r--src/providers/ipa/ipa_hostid.c18
1 files changed, 16 insertions, 2 deletions
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;
}