summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-08 00:48:12 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:02 +0100
commit740870643f337ce70d85f25f9ed057cd1f91028c (patch)
tree319f52b3a9e13a7c14492808a789778f1ee37613 /src/db
parent2913240aee51ce81195148a4d814e967f66839c4 (diff)
downloadsssd-740870643f337ce70d85f25f9ed057cd1f91028c.tar.gz
sssd-740870643f337ce70d85f25f9ed057cd1f91028c.tar.bz2
sssd-740870643f337ce70d85f25f9ed057cd1f91028c.zip
Add domain argument to sysdb selinux functions
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_selinux.c33
-rw-r--r--src/db/sysdb_selinux.h9
2 files changed, 27 insertions, 15 deletions
diff --git a/src/db/sysdb_selinux.c b/src/db/sysdb_selinux.c
index c1fb07fb..b27e0a92 100644
--- a/src/db/sysdb_selinux.c
+++ b/src/db/sysdb_selinux.c
@@ -77,6 +77,7 @@ done:
}
static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sysdb_attrs *attrs,
enum selinux_entity_type type)
{
@@ -109,12 +110,12 @@ static errno_t sysdb_store_selinux_entity(struct sysdb_ctx *sysdb,
}
dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_SEUSERMAP,
- clean_name, sysdb->domain->name);
+ clean_name, domain->name);
break;
case SELINUX_CONFIG:
objectclass = SYSDB_SELINUX_CLASS;
dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_SELINUX_BASE,
- sysdb->domain->name);
+ domain->name);
break;
}
@@ -174,12 +175,14 @@ done:
}
errno_t sysdb_store_selinux_usermap(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sysdb_attrs *attrs)
{
- return sysdb_store_selinux_entity(sysdb, attrs, SELINUX_USER_MAP);
+ return sysdb_store_selinux_entity(sysdb, domain, attrs, SELINUX_USER_MAP);
}
errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *default_user,
const char *order)
{
@@ -210,19 +213,20 @@ errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
goto done;
}
- ret = sysdb_store_selinux_entity(sysdb, attrs, SELINUX_CONFIG);
+ ret = sysdb_store_selinux_entity(sysdb, domain, attrs, SELINUX_CONFIG);
done:
talloc_free(attrs);
return ret;
}
-errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb)
+errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain)
{
struct ldb_dn *dn = NULL;
errno_t ret;
dn = ldb_dn_new_fmt(sysdb, sysdb->ldb,
- SYSDB_TMPL_SELINUX_BASE, sysdb->domain->name);
+ SYSDB_TMPL_SELINUX_BASE, domain->name);
if (!dn) return ENOMEM;
ret = sysdb_delete_recursive(sysdb, dn, true);
@@ -238,6 +242,7 @@ errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb)
/* --- SYSDB SELinux search routines --- */
errno_t sysdb_search_selinux_usermap_by_mapname(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **_usermap)
@@ -267,7 +272,7 @@ errno_t sysdb_search_selinux_usermap_by_mapname(TALLOC_CTX *mem_ctx,
}
basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_SEUSERMAP,
- clean_name, sysdb->domain->name);
+ clean_name, domain->name);
if (!basedn) {
ret = ENOMEM;
goto done;
@@ -295,6 +300,7 @@ done:
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)
@@ -302,9 +308,7 @@ sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
errno_t ret;
char *filter;
struct ldb_dn *basedn;
- struct sss_domain_info *domain;
- domain = sysdb->domain;
basedn = ldb_dn_new_fmt(mem_ctx, sysdb_ctx_get_ldb(sysdb),
SYSDB_TMPL_SELINUX_BASE, domain->name);
if (!basedn) {
@@ -334,6 +338,7 @@ sysdb_get_selinux_usermaps(TALLOC_CTX *mem_ctx,
errno_t sysdb_search_selinux_usermap_by_username(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *username,
struct ldb_message ***_usermaps)
{
@@ -363,8 +368,6 @@ errno_t sysdb_search_selinux_usermap_by_username(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- domain = sysdb->domain;
-
/* Now extract user attributes */
ret = sss_selinux_extract_user(tmp_ctx, sysdb, domain, username, &user);
if (ret != EOK) {
@@ -372,7 +375,8 @@ errno_t sysdb_search_selinux_usermap_by_username(TALLOC_CTX *mem_ctx,
}
/* Now extract all SELinux user maps */
- ret = sysdb_get_selinux_usermaps(tmp_ctx, sysdb, attrs, &msgs_count, &msgs);
+ ret = sysdb_get_selinux_usermaps(tmp_ctx, sysdb, domain,
+ attrs, &msgs_count, &msgs);
if (ret) {
goto done;
}
@@ -441,6 +445,7 @@ done:
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)
{
@@ -458,8 +463,8 @@ errno_t sysdb_search_selinux_config(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_SELINUX_BASE,
- sysdb->domain->name);
+ basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
+ SYSDB_TMPL_SELINUX_BASE, domain->name);
if (!basedn) {
ret = ENOMEM;
goto done;
diff --git a/src/db/sysdb_selinux.h b/src/db/sysdb_selinux.h
index 5fcbb56e..752f2206 100644
--- a/src/db/sysdb_selinux.h
+++ b/src/db/sysdb_selinux.h
@@ -42,34 +42,41 @@ enum selinux_entity_type {
};
errno_t sysdb_store_selinux_usermap(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sysdb_attrs *attrs);
errno_t sysdb_store_selinux_config(struct sysdb_ctx *sysdb,
+ 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_usermap_by_mapname(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **_usermap);
errno_t sysdb_search_selinux_usermap_by_username(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *username,
struct ldb_message ***_usermaps);
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);
+errno_t sysdb_delete_usermaps(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain);
#endif