summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_ops.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 18:37:57 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:01 +0100
commit7c26e3568d0d789067feef945086dff367408a1c (patch)
tree39346e4f175d1c3d7d04087338c478317fb2fc2e /src/db/sysdb_ops.c
parentefc81d1b44169206a2e55bb8e900d3859375abe3 (diff)
downloadsssd-7c26e3568d0d789067feef945086dff367408a1c.tar.gz
sssd-7c26e3568d0d789067feef945086dff367408a1c.tar.xz
sssd-7c26e3568d0d789067feef945086dff367408a1c.zip
Add domain argument to sysdb_add_user()
Diffstat (limited to 'src/db/sysdb_ops.c')
-rw-r--r--src/db/sysdb_ops.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 640a928a5..094ff5eee 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -978,6 +978,7 @@ done:
static errno_t
sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *orig_dn,
struct sysdb_attrs *attrs,
const char *name)
@@ -1026,7 +1027,7 @@ sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb,
goto done;
}
- tmpdn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, name);
+ tmpdn = sysdb_user_dn(sysdb, tmp_ctx, domain, name);
if (!tmpdn) {
ERROR_OUT(ret, ENOMEM, done);
}
@@ -1037,7 +1038,7 @@ sysdb_remove_ghostattr_from_groups(struct sysdb_ctx *sysdb,
}
tmpdn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_TMPL_GROUP_BASE, sysdb->domain->name);
+ SYSDB_TMPL_GROUP_BASE, domain->name);
if (!tmpdn) {
ret = ENOMEM;
goto done;
@@ -1068,6 +1069,7 @@ done:
/* =Add-User-Function===================================================== */
int sysdb_add_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
uid_t uid, gid_t gid,
const char *gecos,
@@ -1084,8 +1086,6 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
uint32_t id;
int ret;
- struct sss_domain_info *domain = sysdb->domain;
-
if (sysdb->mpg) {
if (gid != 0) {
DEBUG(0, ("Cannot add user with arbitrary GID in MPG domain!\n"));
@@ -1195,7 +1195,8 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
if (ret) goto done;
/* remove all ghost users */
- ret = sysdb_remove_ghostattr_from_groups(sysdb, orig_dn, attrs, name);
+ ret = sysdb_remove_ghostattr_from_groups(sysdb, domain,
+ orig_dn, attrs, name);
if (ret) goto done;
ret = EOK;
@@ -1663,7 +1664,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
if (ret == ENOENT) {
/* users doesn't exist, turn into adding a user */
- ret = sysdb_add_user(sysdb, name, uid, gid, gecos, homedir,
+ ret = sysdb_add_user(sysdb, sysdb->domain, name, uid, gid, gecos, homedir,
shell, orig_dn, attrs, cache_timeout, now);
if (ret == EEXIST) {
/* This may be a user rename. If there is a user with the
@@ -1682,7 +1683,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
DEBUG(SSSDBG_MINOR_FAILURE,
("A user with the same UID [%llu] was removed from the "
"cache\n", (unsigned long long) uid));
- ret = sysdb_add_user(sysdb, name, uid, gid, gecos, homedir,
+ ret = sysdb_add_user(sysdb, sysdb->domain, name, uid, gid, gecos, homedir,
shell, orig_dn, attrs, cache_timeout, now);
}