diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-07 18:48:01 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:53:01 +0100 |
commit | 5c1135221ff3ea9132b6ebf073f2dcae88b73b3f (patch) | |
tree | 1b720a242ce96a267ec15717fcbc5423b25c034a /src/db | |
parent | 7c26e3568d0d789067feef945086dff367408a1c (diff) | |
download | sssd-5c1135221ff3ea9132b6ebf073f2dcae88b73b3f.tar.gz sssd-5c1135221ff3ea9132b6ebf073f2dcae88b73b3f.tar.bz2 sssd-5c1135221ff3ea9132b6ebf073f2dcae88b73b3f.zip |
Add domain arguments to sysdb_add_group functions.
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb.h | 3 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index f0eedcd9..dccd0450 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -623,16 +623,19 @@ int sysdb_add_user(struct sysdb_ctx *sysdb, /* Add group (only basic attrs and w/o checks) */ int sysdb_add_basic_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid); /* Add group (all checks) */ int sysdb_add_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *attrs, int cache_timeout, time_t now); int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid, const char *original_dn, bool posix, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 094ff5ee..33c6ac04 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -1216,6 +1216,7 @@ done: /* =Add-Basic-Group-NO-CHECKS============================================= */ int sysdb_add_basic_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid) { struct ldb_message *msg; @@ -1234,7 +1235,7 @@ int sysdb_add_basic_group(struct sysdb_ctx *sysdb, } /* group dn */ - msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain, name); + msg->dn = sysdb_group_dn(sysdb, msg, domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1268,6 +1269,7 @@ done: /* =Add-Group-Function==================================================== */ int sysdb_add_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid, struct sysdb_attrs *attrs, int cache_timeout, @@ -1279,8 +1281,6 @@ int sysdb_add_group(struct sysdb_ctx *sysdb, int ret; bool posix; - struct sss_domain_info *domain = sysdb->domain; - if (domain->id_max != 0 && gid != 0 && (gid < domain->id_min || gid > domain->id_max)) { DEBUG(2, ("Supplied gid [%d] is not in the allowed range [%d-%d].\n", @@ -1325,7 +1325,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb, } /* try to add the group */ - ret = sysdb_add_basic_group(sysdb, name, gid); + ret = sysdb_add_basic_group(sysdb, domain, name, gid); if (ret) goto done; if (!attrs) { @@ -1380,6 +1380,7 @@ done: } int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, gid_t gid, const char *original_dn, @@ -1396,7 +1397,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, } /* try to add the group */ - ret = sysdb_add_basic_group(sysdb, name, gid); + ret = sysdb_add_basic_group(sysdb, domain, name, gid); if (ret) goto done; attrs = sysdb_new_attrs(tmp_ctx); @@ -1424,7 +1425,7 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, if (ret) goto done; } - ret = sysdb_set_group_attr(sysdb, sysdb->domain, name, attrs, SYSDB_MOD_REP); + ret = sysdb_set_group_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP); done: if (ret != EOK) { @@ -1821,7 +1822,8 @@ int sysdb_store_group(struct sysdb_ctx *sysdb, if (new_group) { /* group doesn't exist, turn into adding a group */ - ret = sysdb_add_group(sysdb, name, gid, attrs, cache_timeout, now); + ret = sysdb_add_group(sysdb, sysdb->domain, name, gid, + attrs, cache_timeout, now); if (ret == EEXIST) { /* This may be a group rename. If there is a group with the * same GID, remove it and try to add the basic group again @@ -1838,7 +1840,8 @@ int sysdb_store_group(struct sysdb_ctx *sysdb, DEBUG(SSSDBG_MINOR_FAILURE, ("A group with the same GID [%llu] was removed from the " "cache\n", (unsigned long long) gid)); - ret = sysdb_add_group(sysdb, name, gid, attrs, cache_timeout, now); + ret = sysdb_add_group(sysdb, sysdb->domain, name, gid, + attrs, cache_timeout, now); } goto done; } |