summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-08 01:09:54 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:03 +0100
commit965428847850f1b154130e249f2d942c6065e88d (patch)
treee075b1f0766fb2087dd8719a3a642cceddf51e3a /src
parent681742138b2afbbefa7f14de937beb438409208e (diff)
downloadsssd-965428847850f1b154130e249f2d942c6065e88d.tar.gz
sssd-965428847850f1b154130e249f2d942c6065e88d.tar.xz
sssd-965428847850f1b154130e249f2d942c6065e88d.zip
Add domain arguments to sysdb ssh functions
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb_ssh.c23
-rw-r--r--src/db/sysdb_ssh.h5
-rw-r--r--src/providers/ipa/ipa_hostid.c3
-rw-r--r--src/responder/ssh/sshsrv_cmd.c7
-rw-r--r--src/tests/sysdb_ssh-tests.c6
5 files changed, 30 insertions, 14 deletions
diff --git a/src/db/sysdb_ssh.c b/src/db/sysdb_ssh.c
index 4eabe3d5b..469425f68 100644
--- a/src/db/sysdb_ssh.c
+++ b/src/db/sysdb_ssh.c
@@ -25,12 +25,13 @@
static errno_t
sysdb_update_ssh_host(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
struct sysdb_attrs *attrs)
{
errno_t ret;
- ret = sysdb_store_custom(sysdb, sysdb->domain, name, SSH_HOSTS_SUBDIR, attrs);
+ ret = sysdb_store_custom(sysdb, domain, name, SSH_HOSTS_SUBDIR, attrs);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
("Error storing host %s [%d]: %s\n", name, ret, strerror(ret)));
@@ -42,6 +43,7 @@ sysdb_update_ssh_host(struct sysdb_ctx *sysdb,
errno_t
sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char *alias,
time_t now,
@@ -71,7 +73,7 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
in_transaction = true;
- ret = sysdb_get_ssh_host(tmp_ctx, sysdb, name, search_attrs, &host);
+ ret = sysdb_get_ssh_host(tmp_ctx, sysdb, domain, name, search_attrs, &host);
if (ret != EOK && ret != ENOENT) {
goto done;
}
@@ -146,7 +148,7 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
goto done;
}
- ret = sysdb_update_ssh_host(sysdb, name, attrs);
+ ret = sysdb_update_ssh_host(sysdb, domain, name, attrs);
if (ret != EOK) {
goto done;
}
@@ -176,6 +178,7 @@ done:
errno_t
sysdb_update_ssh_known_host_expire(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
time_t now,
int known_hosts_timeout)
@@ -207,7 +210,7 @@ sysdb_update_ssh_known_host_expire(struct sysdb_ctx *sysdb,
goto done;
}
- ret = sysdb_update_ssh_host(sysdb, name, attrs);
+ ret = sysdb_update_ssh_host(sysdb, domain, name, attrs);
if (ret != EOK) {
goto done;
}
@@ -222,15 +225,17 @@ done:
errno_t
sysdb_delete_ssh_host(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name)
{
DEBUG(SSSDBG_TRACE_FUNC, ("Deleting host %s\n", name));
- return sysdb_delete_custom(sysdb, sysdb->domain, name, SSH_HOSTS_SUBDIR);
+ return sysdb_delete_custom(sysdb, domain, name, SSH_HOSTS_SUBDIR);
}
static errno_t
sysdb_search_ssh_hosts(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *filter,
const char **attrs,
struct ldb_message ***hosts,
@@ -246,7 +251,7 @@ sysdb_search_ssh_hosts(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- ret = sysdb_search_custom(tmp_ctx, sysdb, sysdb->domain, filter,
+ ret = sysdb_search_custom(tmp_ctx, sysdb, domain, filter,
SSH_HOSTS_SUBDIR, attrs,
&num_results, &results);
if (ret != EOK && ret != ENOENT) {
@@ -274,6 +279,7 @@ done:
errno_t
sysdb_get_ssh_host(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **host)
@@ -295,7 +301,7 @@ sysdb_get_ssh_host(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_ssh_hosts(tmp_ctx, sysdb, filter, attrs,
+ ret = sysdb_search_ssh_hosts(tmp_ctx, sysdb, domain, filter, attrs,
&hosts, &num_hosts);
if (ret != EOK) {
goto done;
@@ -320,6 +326,7 @@ done:
errno_t
sysdb_get_ssh_known_hosts(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
time_t now,
const char **attrs,
struct ldb_message ***hosts,
@@ -341,7 +348,7 @@ sysdb_get_ssh_known_hosts(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_search_ssh_hosts(mem_ctx, sysdb, filter, attrs,
+ ret = sysdb_search_ssh_hosts(mem_ctx, sysdb, domain, filter, attrs,
hosts, num_hosts);
done:
diff --git a/src/db/sysdb_ssh.h b/src/db/sysdb_ssh.h
index 9a5159e18..2b0bbc437 100644
--- a/src/db/sysdb_ssh.h
+++ b/src/db/sysdb_ssh.h
@@ -31,6 +31,7 @@
errno_t
sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char *alias,
time_t now,
@@ -38,17 +39,20 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb,
errno_t
sysdb_update_ssh_known_host_expire(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
time_t now,
int known_hosts_timeout);
errno_t
sysdb_delete_ssh_host(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name);
errno_t
sysdb_get_ssh_host(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **host);
@@ -56,6 +60,7 @@ sysdb_get_ssh_host(TALLOC_CTX *mem_ctx,
errno_t
sysdb_get_ssh_known_hosts(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
time_t now,
const char **attrs,
struct ldb_message ***hosts,
diff --git a/src/providers/ipa/ipa_hostid.c b/src/providers/ipa/ipa_hostid.c
index f85454ff6..dfd3a65b3 100644
--- a/src/providers/ipa/ipa_hostid.c
+++ b/src/providers/ipa/ipa_hostid.c
@@ -294,7 +294,8 @@ hosts_get_done(struct tevent_req *subreq)
goto done;
}
- ret = sysdb_store_ssh_host(state->sysdb, state->name, state->alias, now,
+ ret = sysdb_store_ssh_host(state->sysdb, state->domain,
+ state->name, state->alias, now,
attrs);
if (ret != EOK) {
goto done;
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index 5b0292628..1f4035e64 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -364,8 +364,8 @@ ssh_host_pubkeys_search_next(struct ssh_cmd_ctx *cmd_ctx)
return EFAULT;
}
- ret = sysdb_get_ssh_host(cmd_ctx, sysdb, cmd_ctx->name, attrs,
- &cmd_ctx->result);
+ ret = sysdb_get_ssh_host(cmd_ctx, sysdb, cmd_ctx->domain,
+ cmd_ctx->name, attrs, &cmd_ctx->result);
if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Failed to make request to our cache!\n"));
@@ -575,6 +575,7 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
}
ret = sysdb_update_ssh_known_host_expire(cmd_ctx->domain->sysdb,
+ cmd_ctx->domain,
cmd_ctx->name, now,
ssh_ctx->known_hosts_timeout);
if (ret != EOK) {
@@ -606,7 +607,7 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
goto done;
}
- ret = sysdb_get_ssh_known_hosts(tmp_ctx, sysdb, now, attrs,
+ ret = sysdb_get_ssh_known_hosts(tmp_ctx, sysdb, dom, now, attrs,
&hosts, &num_hosts);
if (ret != EOK) {
if (ret != ENOENT) {
diff --git a/src/tests/sysdb_ssh-tests.c b/src/tests/sysdb_ssh-tests.c
index 013a1d43d..c69901638 100644
--- a/src/tests/sysdb_ssh-tests.c
+++ b/src/tests/sysdb_ssh-tests.c
@@ -173,6 +173,7 @@ static int test_sysdb_store_ssh_host(struct test_data *data)
time_t now = time(NULL);
ret = sysdb_store_ssh_host(data->ctx->sysdb,
+ data->ctx->domain,
data->hostname,
data->alias,
now,
@@ -184,7 +185,8 @@ static int test_sysdb_delete_ssh_host(struct test_data *data)
{
int ret;
- ret = sysdb_delete_ssh_host(data->ctx->sysdb, data->hostname);
+ ret = sysdb_delete_ssh_host(data->ctx->sysdb,
+ data->ctx->domain, data->hostname);
return ret;
}
@@ -194,7 +196,7 @@ static int test_sysdb_get_ssh_host(struct test_data *data)
const char *attrs[] = { SYSDB_NAME, NULL };
ret = sysdb_get_ssh_host(data->ctx, data->ctx->sysdb,
- data->hostname, attrs,
+ data->ctx->domain, data->hostname, attrs,
&data->host);
return ret;