summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-11-12 11:36:48 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-11-15 20:20:18 +0100
commit17759fc794c22898d1db609b736fbcd77536d150 (patch)
treea06f7cdc8d7e357b329977a46d16d95a83f9437f
parente7d1cd14ce1a427007b1a7e9789dcb7e9619f84f (diff)
downloadsssd-17759fc794c22898d1db609b736fbcd77536d150.tar.gz
sssd-17759fc794c22898d1db609b736fbcd77536d150.tar.xz
sssd-17759fc794c22898d1db609b736fbcd77536d150.zip
SYSDB: Drop the sysdb_ctx parameter from SELinux functions
-rw-r--r--src/db/sysdb_selinux.c27
-rw-r--r--src/db/sysdb_selinux.h11
-rw-r--r--src/providers/ipa/ipa_selinux.c13
3 files changed, 21 insertions, 30 deletions
diff --git a/src/db/sysdb_selinux.c b/src/db/sysdb_selinux.c
index 905b43a79..63e1a3181 100644
--- a/src/db/sysdb_selinux.c
+++ b/src/db/sysdb_selinux.c
@@ -80,8 +80,7 @@ done:
return ret;
}
-static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+static errno_t sysdb_store_selinux_entity(struct sss_domain_info *domain,
struct sysdb_attrs *attrs,
enum selinux_entity_type type)
{
@@ -94,6 +93,7 @@ static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
errno_t sret = EOK;
errno_t ret;
time_t now;
+ struct sysdb_ctx *sysdb = domain->sysdb;
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) {
@@ -178,15 +178,13 @@ done:
return ret;
}
-errno_t sysdb_store_selinux_usermap(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+errno_t sysdb_store_selinux_usermap(struct sss_domain_info *domain,
struct sysdb_attrs *attrs)
{
- return sysdb_store_selinux_entity(sysdb, domain, attrs, SELINUX_USER_MAP);
+ return sysdb_store_selinux_entity(domain, attrs, SELINUX_USER_MAP);
}
-errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+errno_t sysdb_store_selinux_config(struct sss_domain_info *domain,
const char *default_user,
const char *order)
{
@@ -217,17 +215,17 @@ errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
goto done;
}
- ret = sysdb_store_selinux_entity(sysdb, domain, attrs, SELINUX_CONFIG);
+ ret = sysdb_store_selinux_entity(domain, attrs, SELINUX_CONFIG);
done:
talloc_free(attrs);
return ret;
}
-errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain)
+errno_t sysdb_delete_usermaps(struct sss_domain_info *domain)
{
struct ldb_dn *dn = NULL;
errno_t ret;
+ struct sysdb_ctx *sysdb = domain->sysdb;
dn = ldb_dn_new_fmt(sysdb, sysdb->ldb,
SYSDB_TMPL_SELINUX_BASE, domain->name);
@@ -246,7 +244,6 @@ errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb,
/* --- SYSDB SELinux search routines --- */
errno_t
sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char **attrs,
size_t *count,
@@ -255,6 +252,7 @@ sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
errno_t ret;
char *filter;
struct ldb_dn *basedn;
+ struct sysdb_ctx *sysdb = domain->sysdb;
basedn = ldb_dn_new_fmt(mem_ctx, sysdb_ctx_get_ldb(sysdb),
SYSDB_TMPL_SELINUX_BASE, domain->name);
@@ -284,7 +282,6 @@ sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
}
errno_t sysdb_search_selinux_config(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char **attrs,
struct ldb_message **_config)
@@ -303,15 +300,15 @@ errno_t sysdb_search_selinux_config(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ basedn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb,
SYSDB_TMPL_SELINUX_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_search_entry(tmp_ctx, sysdb, basedn, LDB_SCOPE_BASE, NULL,
- attrs?attrs:def_attrs, &msgs_count, &msgs);
+ ret = sysdb_search_entry(tmp_ctx, domain->sysdb, basedn, LDB_SCOPE_BASE,
+ NULL, attrs?attrs:def_attrs, &msgs_count, &msgs);
if (ret) {
goto done;
}
diff --git a/src/db/sysdb_selinux.h b/src/db/sysdb_selinux.h
index a40e7b52f..988f4f800 100644
--- a/src/db/sysdb_selinux.h
+++ b/src/db/sysdb_selinux.h
@@ -36,29 +36,24 @@
#define SYSDB_SELINUX_DEFAULT_ORDER "order"
#define SYSDB_SELINUX_HOST_PRIORITY "hostPriority"
-errno_t sysdb_store_selinux_usermap(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+errno_t sysdb_store_selinux_usermap(struct sss_domain_info *domain,
struct sysdb_attrs *attrs);
-errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain,
+errno_t sysdb_store_selinux_config(struct sss_domain_info *domain,
const char *default_map,
const char *order);
errno_t sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char **attrs,
size_t *count,
struct ldb_message ***messages);
errno_t sysdb_search_selinux_config(TALLOC_CTX *mem_ctx,
- struct sysdb_ctx *sysdb,
struct sss_domain_info *domain,
const char **attrs,
struct ldb_message **_config);
-errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb,
- struct sss_domain_info *domain);
+errno_t sysdb_delete_usermaps(struct sss_domain_info *domain);
#endif
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index bb7b40452..d6bb41c45 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -171,7 +171,7 @@ ipa_save_user_maps(struct sysdb_ctx *sysdb,
in_transaction = true;
for (i = 0; i < map_count; i++) {
- ret = sysdb_store_selinux_usermap(sysdb ,domain, maps[i]);
+ ret = sysdb_store_selinux_usermap(domain, maps[i]);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Failed to store user map %d. "
"Ignoring.\n", i));
@@ -331,14 +331,14 @@ static void ipa_selinux_handler_done(struct tevent_req *req)
}
in_transaction = true;
- ret = sysdb_delete_usermaps(op_ctx->domain->sysdb, op_ctx->domain);
+ ret = sysdb_delete_usermaps(op_ctx->domain);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Cannot delete existing maps from sysdb\n"));
goto fail;
}
- ret = sysdb_store_selinux_config(sysdb, op_ctx->domain,
+ ret = sysdb_store_selinux_config(op_ctx->domain,
default_user, map_order);
if (ret != EOK) {
goto fail;
@@ -1031,8 +1031,8 @@ ipa_get_selinux_maps_offline(struct tevent_req *req)
struct ipa_get_selinux_state);
/* read the config entry */
- ret = sysdb_search_selinux_config(state, state->be_ctx->domain->sysdb,
- state->be_ctx->domain, NULL, &defaults);
+ ret = sysdb_search_selinux_config(state, state->be_ctx->domain,
+ NULL, &defaults);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_search_selinux_config failed [%d]: %s\n",
ret, strerror(ret)));
@@ -1064,8 +1064,7 @@ ipa_get_selinux_maps_offline(struct tevent_req *req)
}
/* read all the SELinux rules */
- ret = sysdb_get_selinux_usermaps(state, state->be_ctx->domain->sysdb,
- state->be_ctx->domain,
+ ret = sysdb_get_selinux_usermaps(state, state->be_ctx->domain,
attrs, &nmaps, &maps);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_get_selinux_usermaps failed [%d]: %s\n",