summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-08 13:45:55 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:03 +0100
commitc14184c07634801cda7864aa17c6fa8dc9ab43d1 (patch)
tree2dfce6637085a2c5975eb610cfd1c724c424b293 /src
parent46675b5033169e1e954cd570413ce85b2c5e11fc (diff)
downloadsssd-c14184c07634801cda7864aa17c6fa8dc9ab43d1.tar.gz
sssd-c14184c07634801cda7864aa17c6fa8dc9ab43d1.tar.xz
sssd-c14184c07634801cda7864aa17c6fa8dc9ab43d1.zip
Move mpg flag to the domain where it belongs
A sysdb contains now multiple domains, but the mpg property is a property of a specific domain not of the underlying database.
Diffstat (limited to 'src')
-rw-r--r--src/confdb/confdb.c3
-rw-r--r--src/confdb/confdb.h1
-rw-r--r--src/db/sysdb.c6
-rw-r--r--src/db/sysdb_ops.c10
-rw-r--r--src/db/sysdb_private.h1
-rw-r--r--src/db/sysdb_search.c6
-rw-r--r--src/db/sysdb_subdomains.c1
-rw-r--r--src/util/domain_info_utils.c1
8 files changed, 13 insertions, 16 deletions
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index 600d423d0..00643cd39 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -859,6 +859,9 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ret = EINVAL;
goto done;
}
+
+ /* The LOCAL provider use always Magic Private Groups */
+ domain->mpg = true;
}
domain->timeout = ldb_msg_find_attr_as_int(res->msgs[0],
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index eb16d01e0..81323dda7 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -201,6 +201,7 @@ struct sss_domain_info {
int timeout;
bool enumerate;
bool fqnames;
+ bool mpg;
bool ignore_group_members;
uint32_t id_min;
uint32_t id_max;
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 62c33f232..a35664d19 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -972,12 +972,6 @@ int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
}
sysdb->domain = domain;
- /* The local provider s the only true MPG,
- * for the other domains, the provider actually unrolls MPGs */
- if (strcasecmp(domain->provider, "local") == 0) {
- sysdb->mpg = true;
- }
-
ret = sysdb_get_db_file(sysdb, domain->provider,
domain->name, db_path,
&sysdb->ldb_file);
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 5e6f6fb0a..46ab64d39 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1086,7 +1086,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
uint32_t id;
int ret;
- if (sysdb->mpg) {
+ if (domain->mpg) {
if (gid != 0) {
DEBUG(0, ("Cannot add user with arbitrary GID in MPG domain!\n"));
return EINVAL;
@@ -1120,7 +1120,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
return ret;
}
- if (sysdb->mpg) {
+ if (domain->mpg) {
/* In MPG domains you can't have groups with the same name as users,
* search if a group with the same name exists.
* Don't worry about users, if we try to add a user with the same
@@ -1161,7 +1161,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
ret = sysdb_attrs_add_uint32(id_attrs, SYSDB_UIDNUM, id);
if (ret) goto done;
- if (sysdb->mpg) {
+ if (domain->mpg) {
ret = sysdb_attrs_add_uint32(id_attrs, SYSDB_GIDNUM, id);
if (ret) goto done;
}
@@ -1300,7 +1300,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
return ret;
}
- if (sysdb->mpg) {
+ if (domain->mpg) {
/* In MPG domains you can't have groups with the same name as users,
* search if a group with the same name exists.
* Don't worry about users, if we try to add a user with the same
@@ -1710,7 +1710,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
if (ret) goto fail;
}
- if (uid && !gid && sysdb->mpg) {
+ if (uid && !gid && domain->mpg) {
ret = sysdb_attrs_add_uint32(attrs, SYSDB_GIDNUM, uid);
if (ret) goto fail;
}
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
index 4eea09041..5a900f17c 100644
--- a/src/db/sysdb_private.h
+++ b/src/db/sysdb_private.h
@@ -84,7 +84,6 @@
struct sysdb_ctx {
struct sss_domain_info *domain; /* *DEPRECATED*, do not use! */
- bool mpg;
struct ldb_context *ldb;
char *ldb_file;
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 0bc813a69..8ff29c37a 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -227,7 +227,7 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (sysdb->mpg) {
+ if (domain->mpg) {
fmt_filter = SYSDB_GRNAM_MPG_FILTER;
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
@@ -299,7 +299,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (sysdb->mpg) {
+ if (domain->mpg) {
fmt_filter = SYSDB_GRGID_MPG_FILTER;
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
@@ -349,7 +349,7 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- if (sysdb->mpg) {
+ if (domain->mpg) {
fmt_filter = SYSDB_GRENT_MPG_FILTER;
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
SYSDB_DOM_BASE, domain->name);
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 6a3f9ee6c..2d8470d5d 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -561,7 +561,6 @@ errno_t sysdb_get_subdomain_context(TALLOC_CTX *mem_ctx,
}
new_ctx->domain = subdomain;
- new_ctx->mpg = true;
new_ctx->ldb = sysdb->ldb;
new_ctx->ldb_file = sysdb->ldb_file;
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index c016258e8..45b9f7b5f 100644
--- a/src/util/domain_info_utils.c
+++ b/src/util/domain_info_utils.c
@@ -74,6 +74,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
dom->enumerate = false;
dom->fqnames = true;
+ dom->mpg = true;
/* FIXME: get ranges from the server */
dom->id_min = 0;
dom->id_max = 0xffffffff;