summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/db/sysdb.h12
-rw-r--r--src/db/sysdb_ops.c12
-rw-r--r--src/db/sysdb_subdomains.c18
-rw-r--r--src/providers/ipa/ipa_s2n_exop.c9
-rw-r--r--src/providers/ldap/sdap_async_users.c5
-rw-r--r--src/providers/proxy/proxy_id.c18
-rw-r--r--src/responder/pac/pacsrv_cmd.c2
-rw-r--r--src/tests/sysdb-tests.c23
8 files changed, 38 insertions, 61 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 392746c8..4e11fbe5 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -385,17 +385,6 @@ errno_t sysdb_master_domain_add_info(struct sysdb_ctx *sysdb,
struct sysdb_subdom *domain_info);
-errno_t sysdb_store_domuser(struct sss_domain_info *domain,
- const char *name,
- const char *pwd,
- uid_t uid, gid_t gid,
- const char *gecos,
- const char *homedir,
- const char *shell,
- struct sysdb_attrs *attrs,
- char **remove_attrs,
- uint64_t cache_timeout,
- time_t now);
errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
const char *name, uid_t uid);
@@ -662,6 +651,7 @@ int sysdb_mod_group_member(struct sysdb_ctx *sysdb,
int mod_op);
int sysdb_store_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char *pwd,
uid_t uid, gid_t gid,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 0b6951a6..61a0e77d 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1610,6 +1610,7 @@ done:
* this will just remove it */
int sysdb_store_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char *pwd,
uid_t uid, gid_t gid,
@@ -1641,7 +1642,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
}
}
- if (pwd && (sysdb->domain->legacy_passwords || !*pwd)) {
+ if (pwd && (domain->legacy_passwords || !*pwd)) {
ret = sysdb_attrs_add_string(attrs, SYSDB_PWD, pwd);
if (ret) goto fail;
}
@@ -1654,8 +1655,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
in_transaction = true;
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, sysdb->domain,
- name, NULL, &msg);
+ ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain, name, NULL, &msg);
if (ret && ret != ENOENT) {
goto fail;
}
@@ -1667,7 +1667,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, sysdb->domain, name, uid, gid, gecos, homedir,
+ ret = sysdb_add_user(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
@@ -1686,7 +1686,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, sysdb->domain, name, uid, gid, gecos, homedir,
+ ret = sysdb_add_user(sysdb, domain, name, uid, gid, gecos, homedir,
shell, orig_dn, attrs, cache_timeout, now);
}
@@ -1738,7 +1738,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto fail;
- ret = sysdb_set_user_attr(sysdb, sysdb->domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_user_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
if (ret != EOK) goto fail;
if (remove_attrs) {
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index ef6b0ad3..4a81b1df 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -577,24 +577,6 @@ errno_t sysdb_get_subdomain_context(TALLOC_CTX *mem_ctx,
} \
} while(0)
-errno_t sysdb_store_domuser(struct sss_domain_info *domain,
- const char *name,
- const char *pwd,
- uid_t uid, gid_t gid,
- const char *gecos,
- const char *homedir,
- const char *shell,
- struct sysdb_attrs *attrs,
- char **remove_attrs,
- uint64_t cache_timeout,
- time_t now)
-{
- CHECK_DOMAIN_INFO(domain);
-
- return sysdb_store_user(domain->sysdb, name, pwd, uid, gid, gecos, homedir,
- shell, NULL, attrs, remove_attrs, cache_timeout, now);
-}
-
errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
const char *name, uid_t uid)
{
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 8fc22819..347a0606 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -684,11 +684,10 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
goto done;
}
- ret = sysdb_store_domuser(state->dom, name, NULL,
- attrs->a.user.pw_uid,
- 0, NULL, /* gecos */
- homedir, NULL,
- user_attrs, NULL, timeout, now);
+ ret = sysdb_store_user(state->dom->sysdb, state->dom, name, NULL,
+ attrs->a.user.pw_uid, 0, NULL, /* gecos */
+ homedir, NULL, NULL, user_attrs, NULL,
+ timeout, now);
break;
case RESP_GROUP:
/* we always use the fully qualified name for subdomain users */
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index ade1d37b..cd577a7f 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -378,8 +378,9 @@ int sdap_save_user(TALLOC_CTX *memctx,
DEBUG(6, ("Storing info for user %s\n", name));
- ret = sysdb_store_user(ctx, name, pwd, uid, gid, gecos, homedir, shell,
- orig_dn, user_attrs, missing, cache_timeout, now);
+ ret = sysdb_store_user(ctx, dom, name, pwd, uid, gid,
+ gecos, homedir, shell, orig_dn,
+ user_attrs, missing, cache_timeout, now);
if (ret) goto done;
if (_usn_value) {
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 57449417..76fbad45 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -27,8 +27,8 @@
/* =Getpwnam-wrapper======================================================*/
-static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
- struct passwd *pwd, const char *real_name,
+static int save_user(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
+ bool lowercase, struct passwd *pwd, const char *real_name,
const char *alias, uint64_t cache_timeout);
static int
@@ -131,7 +131,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
}
/* Both lookups went fine, we can save the user now */
- ret = save_user(sysdb, !dom->case_sensitive, pwd,
+ ret = save_user(sysdb, dom, !dom->case_sensitive, pwd,
real_name, name, dom->user_timeout);
done:
@@ -210,8 +210,8 @@ delete_user(struct sysdb_ctx *sysdb, const char *name, uid_t uid)
return ret;
}
-static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
- struct passwd *pwd, const char *real_name,
+static int save_user(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
+ bool lowercase, struct passwd *pwd, const char *real_name,
const char *alias, uint64_t cache_timeout)
{
const char *shell;
@@ -265,7 +265,7 @@ static int save_user(struct sysdb_ctx *sysdb, bool lowercase,
}
}
- ret = sysdb_store_user(sysdb,
+ ret = sysdb_store_user(sysdb, domain,
real_name,
pwd->pw_passwd,
pwd->pw_uid,
@@ -336,7 +336,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = save_user(sysdb, !dom->case_sensitive, pwd,
+ ret = save_user(sysdb, dom, !dom->case_sensitive, pwd,
pwd->pw_name, NULL, dom->user_timeout);
done:
@@ -458,7 +458,7 @@ static int enum_users(TALLOC_CTX *mem_ctx,
break;
}
- ret = save_user(sysdb, !dom->case_sensitive, pwd,
+ ret = save_user(sysdb, dom, !dom->case_sensitive, pwd,
pwd->pw_name, NULL, dom->user_timeout);
if (ret) {
/* Do not fail completely on errors.
@@ -1224,7 +1224,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = save_user(sysdb, !dom->case_sensitive, pwd,
+ ret = save_user(sysdb, dom, !dom->case_sensitive, pwd,
real_name, name, dom->user_timeout);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not save user\n"));
diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c
index 670421cf..df26b3e7 100644
--- a/src/responder/pac/pacsrv_cmd.c
+++ b/src/responder/pac/pacsrv_cmd.c
@@ -401,7 +401,7 @@ static errno_t save_pac_user(struct pac_req_ctx *pr_ctx)
goto done;
}
- ret = sysdb_store_user(sysdb, pwd->pw_name, NULL,
+ ret = sysdb_store_user(sysdb, pr_ctx->dom, pwd->pw_name, NULL,
pwd->pw_uid, pwd->pw_gid, pwd->pw_gecos,
pwd->pw_dir,
pwd->pw_shell, NULL, user_attrs, NULL,
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 91298e14..e1944809 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -206,7 +206,8 @@ static int test_store_user(struct test_data *data)
homedir = talloc_asprintf(data, "/home/testuser%d", data->uid);
gecos = talloc_asprintf(data, "Test User %d", data->uid);
- ret = sysdb_store_user(data->ctx->sysdb, data->username, "x",
+ ret = sysdb_store_user(data->ctx->sysdb, data->ctx->domain,
+ data->username, "x",
data->uid, 0, gecos, homedir,
data->shell ? data->shell : "/bin/bash",
NULL, NULL, NULL, -1, 0);
@@ -3376,7 +3377,8 @@ START_TEST(test_user_rename)
fail_unless(ret == EOK, "Could not set up the test");
/* Store and verify the first user */
- ret = sysdb_store_user(test_ctx->sysdb, fromname, NULL, userid, 0,
+ ret = sysdb_store_user(test_ctx->sysdb, test_ctx->domain,
+ fromname, NULL, userid, 0,
fromname, "/", "/bin/sh",
NULL, NULL, NULL, 0, 0);
fail_unless(ret == EOK, "Could not add first user");
@@ -3403,8 +3405,9 @@ START_TEST(test_user_rename)
fromname, "/", "/bin/sh", NULL, NULL, 0, 0);
fail_unless(ret == EEXIST, "A second user added with low level call?");
- ret = sysdb_store_user(test_ctx->sysdb, toname, NULL, userid, 0,
- fromname, "/", "/bin/sh", NULL, NULL, NULL, 0, 0);
+ ret = sysdb_store_user(test_ctx->sysdb, test_ctx->domain, toname, NULL,
+ userid, 0, fromname, "/", "/bin/sh",
+ NULL, NULL, NULL, 0, 0);
fail_unless(ret == EOK, "Could not add second user");
ret = sysdb_getpwnam(test_ctx, test_ctx->sysdb,
@@ -4359,8 +4362,9 @@ START_TEST(test_sysdb_subdomain_store_user)
NULL, NULL);
fail_unless(subdomain != NULL, "new_subdomain failed.");
- ret = sysdb_store_user(subdomain->sysdb, "subdomuser", NULL, 12345, 0,
- "Sub Domain User", "/home/subdomuser", "/bin/bash",
+ ret = sysdb_store_user(subdomain->sysdb, subdomain, "subdomuser",
+ NULL, 12345, 0, "Sub Domain User",
+ "/home/subdomuser", "/bin/bash",
NULL, NULL, NULL, -1, 0);
fail_unless(ret == EOK, "sysdb_store_user failed.");
@@ -4414,9 +4418,10 @@ START_TEST(test_sysdb_subdomain_user_ops)
NULL, NULL);
fail_unless(subdomain != NULL, "new_subdomain failed.");
- ret = sysdb_store_domuser(subdomain, "subdomuser", NULL, 12345, 0,
- "Sub Domain User", "/home/subdomuser", "/bin/bash",
- NULL, NULL, -1, 0);
+ ret = sysdb_store_user(subdomain->sysdb, subdomain, "subdomuser",
+ NULL, 12345, 0, "Sub Domain User",
+ "/home/subdomuser", "/bin/bash",
+ NULL, NULL, NULL, -1, 0);
fail_unless(ret == EOK, "sysdb_store_domuser failed.");
check_dn = ldb_dn_new(test_ctx, test_ctx->sysdb->ldb,