summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-08 01:25:47 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:03 +0100
commitb0fa48b0d612b46a86e45f8e4b5d9feae9784c2b (patch)
tree8df34df06567f926284a27b775fb923b39bc4a6d /src/providers
parent965428847850f1b154130e249f2d942c6065e88d (diff)
downloadsssd-b0fa48b0d612b46a86e45f8e4b5d9feae9784c2b.tar.gz
sssd-b0fa48b0d612b46a86e45f8e4b5d9feae9784c2b.tar.xz
sssd-b0fa48b0d612b46a86e45f8e4b5d9feae9784c2b.zip
Add domain arguments to sysdb sudo functions
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ldap/sdap_async_sudo.c14
-rw-r--r--src/providers/ldap/sdap_sudo.c9
-rw-r--r--src/providers/ldap/sdap_sudo_cache.c7
-rw-r--r--src/providers/ldap/sdap_sudo_cache.h1
4 files changed, 22 insertions, 9 deletions
diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c
index 974d3b174..2e61fc631 100644
--- a/src/providers/ldap/sdap_async_sudo.c
+++ b/src/providers/ldap/sdap_async_sudo.c
@@ -95,6 +95,7 @@ static int sdap_sudo_purge_sudoers(struct sysdb_ctx *sysdb_ctx,
static int sdap_sudo_store_sudoers(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb_ctx,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
size_t rules_count,
struct sysdb_attrs **rules,
@@ -495,8 +496,9 @@ static void sdap_sudo_refresh_load_done(struct tevent_req *subreq)
/* store rules */
now = time(NULL);
- ret = sdap_sudo_store_sudoers(state, state->sysdb, state->opts, rules_count,
- rules, state->domain->sudo_timeout, now,
+ ret = sdap_sudo_store_sudoers(state, state->sysdb, state->domain,
+ state->opts, rules_count, rules,
+ state->domain->sudo_timeout, now,
&state->highest_usn);
if (ret != EOK) {
goto done;
@@ -560,7 +562,7 @@ static int sdap_sudo_purge_sudoers(struct sysdb_ctx *sysdb_ctx,
continue;
}
- ret = sysdb_sudo_purge_byname(sysdb_ctx, name);
+ ret = sysdb_sudo_purge_byname(sysdb_ctx, dom, name);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
("Failed to delete rule %s: [%s]\n",
@@ -589,6 +591,7 @@ done:
static int sdap_sudo_store_sudoers(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb_ctx,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
size_t rules_count,
struct sysdb_attrs **rules,
@@ -603,8 +606,9 @@ static int sdap_sudo_store_sudoers(TALLOC_CTX *mem_ctx,
return EOK;
}
- ret = sdap_save_native_sudorule_list(mem_ctx, sysdb_ctx, opts->sudorule_map,
- rules, rules_count, cache_timeout, now,
+ ret = sdap_save_native_sudorule_list(mem_ctx, sysdb_ctx, domain,
+ opts->sudorule_map, rules,
+ rules_count, cache_timeout, now,
_usn);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("failed to save sudo rules [%d]: %s\n",
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index de16a84c0..990eed1ad 100644
--- a/src/providers/ldap/sdap_sudo.c
+++ b/src/providers/ldap/sdap_sudo.c
@@ -36,6 +36,7 @@ struct sdap_sudo_full_refresh_state {
struct sdap_sudo_ctx *sudo_ctx;
struct sdap_id_ctx *id_ctx;
struct sysdb_ctx *sysdb;
+ struct sss_domain_info *domain;
int dp_error;
int error;
};
@@ -250,7 +251,9 @@ static int sdap_sudo_setup_periodical_refresh(struct sdap_sudo_ctx *sudo_ctx)
}
}
- ret = sysdb_sudo_get_last_full_refresh(id_ctx->be->sysdb, &last_full);
+ ret = sysdb_sudo_get_last_full_refresh(id_ctx->be->sysdb,
+ id_ctx->be->domain,
+ &last_full);
if (ret != EOK) {
return ret;
}
@@ -553,6 +556,7 @@ static struct tevent_req *sdap_sudo_full_refresh_send(TALLOC_CTX *mem_ctx,
state->sudo_ctx = sudo_ctx;
state->id_ctx = id_ctx;
state->sysdb = id_ctx->be->sysdb;
+ state->domain = id_ctx->be->domain;
/* Download all rules from LDAP */
ldap_filter = talloc_asprintf(state, SDAP_SUDO_FILTER_CLASS,
@@ -627,7 +631,8 @@ static void sdap_sudo_full_refresh_done(struct tevent_req *subreq)
state->sudo_ctx->full_refresh_done = true;
/* save the time in the sysdb */
- ret = sysdb_sudo_set_last_full_refresh(state->sysdb, time(NULL));
+ ret = sysdb_sudo_set_last_full_refresh(state->sysdb, state->domain,
+ time(NULL));
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE, ("Unable to save time of "
"a successful full refresh\n"));
diff --git a/src/providers/ldap/sdap_sudo_cache.c b/src/providers/ldap/sdap_sudo_cache.c
index 499db02f6..3c438b930 100644
--- a/src/providers/ldap/sdap_sudo_cache.c
+++ b/src/providers/ldap/sdap_sudo_cache.c
@@ -57,6 +57,7 @@ static errno_t sdap_sudo_get_usn(TALLOC_CTX *mem_ctx,
static errno_t
sdap_save_native_sudorule(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb_ctx,
+ struct sss_domain_info *domain,
struct sdap_attr_map *map,
struct sysdb_attrs *attrs,
int cache_timeout,
@@ -88,7 +89,7 @@ sdap_save_native_sudorule(TALLOC_CTX *mem_ctx,
return ret;
}
- ret = sysdb_save_sudorule(sysdb_ctx, rule_name, attrs);
+ ret = sysdb_save_sudorule(sysdb_ctx, domain, rule_name, attrs);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not save sudorule %s\n", rule_name));
return ret;
@@ -100,6 +101,7 @@ sdap_save_native_sudorule(TALLOC_CTX *mem_ctx,
errno_t
sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb_ctx,
+ struct sss_domain_info *domain,
struct sdap_attr_map *map,
struct sysdb_attrs **replies,
size_t replies_count,
@@ -129,7 +131,8 @@ sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx,
for (i=0; i<replies_count; i++) {
usn_value = NULL;
- ret = sdap_save_native_sudorule(tmp_ctx, sysdb_ctx, map, replies[i],
+ ret = sdap_save_native_sudorule(tmp_ctx, sysdb_ctx,
+ domain, map, replies[i],
cache_timeout, now, &usn_value);
if (ret != EOK) {
goto fail;
diff --git a/src/providers/ldap/sdap_sudo_cache.h b/src/providers/ldap/sdap_sudo_cache.h
index 6413d2361..d156e5cfb 100644
--- a/src/providers/ldap/sdap_sudo_cache.h
+++ b/src/providers/ldap/sdap_sudo_cache.h
@@ -27,6 +27,7 @@
errno_t
sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb_ctx,
+ struct sss_domain_info *domain,
struct sdap_attr_map *map,
struct sysdb_attrs **replies,
size_t replies_count,