summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 23:27:51 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:02 +0100
commit3412d14d65490c32414e72ac20fe21bad53ceb45 (patch)
treee63253f040369cfe88fa37a40377704072a168f7 /src
parent044868b388b4e47499f12a9105310b247bbe1ce2 (diff)
downloadsssd-3412d14d65490c32414e72ac20fe21bad53ceb45.tar.gz
sssd-3412d14d65490c32414e72ac20fe21bad53ceb45.tar.bz2
sssd-3412d14d65490c32414e72ac20fe21bad53ceb45.zip
Add domain argument to sysdb_delete_user()
Also remove sysdb_delete_domuser()
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h6
-rw-r--r--src/db/sysdb_ops.c7
-rw-r--r--src/db/sysdb_subdomains.c8
-rw-r--r--src/providers/ldap/ldap_id.c8
-rw-r--r--src/providers/ldap/ldap_id_cleanup.c2
-rw-r--r--src/providers/proxy/proxy_id.c20
-rw-r--r--src/responder/pac/pacsrv_cmd.c2
-rw-r--r--src/tests/sysdb-tests.c13
8 files changed, 32 insertions, 34 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index e180b682..5f406e31 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -384,11 +384,6 @@ errno_t sysdb_master_domain_get_info(TALLOC_CTX *mem_ctx,
errno_t sysdb_master_domain_add_info(struct sysdb_ctx *sysdb,
struct sysdb_subdom *domain_info);
-
-errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
- const char *name, uid_t uid);
-
-
errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
const char *name, gid_t gid);
@@ -762,6 +757,7 @@ int sysdb_search_users(TALLOC_CTX *mem_ctx,
struct ldb_message ***msgs);
int sysdb_delete_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name, uid_t uid);
int sysdb_search_groups(TALLOC_CTX *mem_ctx,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 4a0ed57b..4b885d67 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1673,7 +1673,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
/* This may be a user rename. If there is a user with the
* same UID, remove it and try to add the basic user again
*/
- ret = sysdb_delete_user(sysdb, NULL, uid);
+ ret = sysdb_delete_user(sysdb, domain, NULL, uid);
if (ret == ENOENT) {
/* Not found by UID, return the original EEXIST,
* this may be a conflict in MPG domain or something
@@ -2404,6 +2404,7 @@ fail:
/* =Delete-User-by-Name-OR-uid============================================ */
int sysdb_delete_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name, uid_t uid)
{
TALLOC_CTX *tmp_ctx;
@@ -2421,10 +2422,10 @@ int sysdb_delete_user(struct sysdb_ctx *sysdb,
}
if (name) {
- ret = sysdb_search_user_by_name(tmp_ctx, sysdb, sysdb->domain,
+ ret = sysdb_search_user_by_name(tmp_ctx, sysdb, domain,
name, NULL, &msg);
} else {
- ret = sysdb_search_user_by_uid(tmp_ctx, sysdb, sysdb->domain,
+ ret = sysdb_search_user_by_uid(tmp_ctx, sysdb, domain,
uid, NULL, &msg);
}
if (ret == EOK) {
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 6ec3e4f4..10de8502 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -577,14 +577,6 @@ errno_t sysdb_get_subdomain_context(TALLOC_CTX *mem_ctx,
} \
} while(0)
-errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
- const char *name, uid_t uid)
-{
- CHECK_DOMAIN_INFO(domain);
-
- return sysdb_delete_user(domain->sysdb, name, uid);
-}
-
errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
const char *name, gid_t gid)
{
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index 1a468906..95455d01 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -256,7 +256,8 @@ static void users_get_done(struct tevent_req *subreq)
tevent_req_error(req, ret);
return;
case BE_FILTER_NAME:
- ret = sysdb_delete_user(state->sysdb, state->name, 0);
+ ret = sysdb_delete_user(state->sysdb,
+ state->domain, state->name, 0);
if (ret != EOK && ret != ENOENT) {
tevent_req_error(req, ret);
return;
@@ -270,7 +271,7 @@ static void users_get_done(struct tevent_req *subreq)
return;
}
- ret = sysdb_delete_user(state->sysdb, NULL, uid);
+ ret = sysdb_delete_user(state->sysdb, state->domain, NULL, uid);
if (ret != EOK && ret != ENOENT) {
tevent_req_error(req, ret);
return;
@@ -732,7 +733,8 @@ static void groups_by_user_done(struct tevent_req *subreq)
}
if (ret == ENOENT) {
- ret = sysdb_delete_user(state->ctx->be->sysdb, state->name, 0);
+ ret = sysdb_delete_user(state->ctx->be->sysdb,
+ state->ctx->be->domain, state->name, 0);
if (ret != EOK && ret != ENOENT) {
tevent_req_error(req, ret);
return;
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 6e138b31..77c4d94e 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -337,7 +337,7 @@ static int cleanup_users(TALLOC_CTX *memctx, struct sdap_id_ctx *ctx)
/* If not logged in or cannot check the table, delete him */
DEBUG(9, ("About to delete user %s\n", name));
- ret = sysdb_delete_user(sysdb, name, 0);
+ ret = sysdb_delete_user(sysdb, ctx->be->domain, name, 0);
if (ret) {
goto done;
}
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 25637783..4ce00b4f 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -36,7 +36,9 @@ handle_getpw_result(enum nss_status status, struct passwd *pwd,
struct sss_domain_info *dom, bool *del_user);
static int
-delete_user(struct sysdb_ctx *sysdb, const char *name, uid_t uid);
+delete_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
+ const char *name, uid_t uid);
static int get_pw_name(TALLOC_CTX *mem_ctx,
struct proxy_id_ctx *ctx,
@@ -86,7 +88,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- ret = delete_user(sysdb, name, 0);
+ ret = delete_user(sysdb, dom, name, 0);
goto done;
}
@@ -126,7 +128,7 @@ static int get_pw_name(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- ret = delete_user(sysdb, name, uid);
+ ret = delete_user(sysdb, dom, name, uid);
goto done;
}
@@ -195,14 +197,16 @@ handle_getpw_result(enum nss_status status, struct passwd *pwd,
}
static int
-delete_user(struct sysdb_ctx *sysdb, const char *name, uid_t uid)
+delete_user(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
+ const char *name, uid_t uid)
{
int ret = EOK;
DEBUG(SSSDBG_TRACE_FUNC,
("User %s does not exist (or is invalid) on remote server,"
" deleting!\n", name));
- ret = sysdb_delete_user(sysdb, name, uid);
+ ret = sysdb_delete_user(sysdb, domain, name, uid);
if (ret == ENOENT) {
ret = EOK;
}
@@ -332,7 +336,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- ret = delete_user(sysdb, NULL, uid);
+ ret = delete_user(sysdb, dom, NULL, uid);
goto done;
}
@@ -1172,7 +1176,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- ret = delete_user(sysdb, name, 0);
+ ret = delete_user(sysdb, dom, name, 0);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not delete user\n"));
goto fail;
@@ -1216,7 +1220,7 @@ static int get_initgr(TALLOC_CTX *mem_ctx,
}
if (del_user) {
- ret = delete_user(sysdb, name, uid);
+ ret = delete_user(sysdb, dom, name, uid);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE, ("Could not delete user\n"));
goto fail;
diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c
index df26b3e7..aeb41847 100644
--- a/src/responder/pac/pacsrv_cmd.c
+++ b/src/responder/pac/pacsrv_cmd.c
@@ -388,7 +388,7 @@ static errno_t save_pac_user(struct pac_req_ctx *pr_ctx)
pwd->pw_uid, attrs, &msg);
if (ret == EOK) {
if (new_and_cached_user_differs(pwd, msg)) {
- ret = sysdb_delete_user(sysdb, NULL, pwd->pw_uid);
+ ret = sysdb_delete_user(sysdb, pr_ctx->dom, NULL, pwd->pw_uid);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_delete_user failed.\n"));
goto done;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 595ef0a7..105d72f8 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -231,7 +231,8 @@ static int test_remove_user_by_uid(struct test_data *data)
{
int ret;
- ret = sysdb_delete_user(data->ctx->sysdb, NULL, data->uid);
+ ret = sysdb_delete_user(data->ctx->sysdb,
+ data->ctx->domain, NULL, data->uid);
return ret;
}
@@ -247,7 +248,8 @@ static int test_remove_nonexistent_user(struct test_data *data)
{
int ret;
- ret = sysdb_delete_user(data->ctx->sysdb, NULL, data->uid);
+ ret = sysdb_delete_user(data->ctx->sysdb,
+ data->ctx->domain, NULL, data->uid);
return ret;
}
@@ -3802,7 +3804,8 @@ START_TEST(test_odd_characters)
talloc_free(res);
/* Delete User */
- ret = sysdb_delete_user(test_ctx->sysdb, odd_username, 10000);
+ ret = sysdb_delete_user(test_ctx->sysdb, test_ctx->domain,
+ odd_username, 10000);
fail_unless(ret == EOK, "sysdb_delete_user error [%d][%s]",
ret, strerror(ret));
@@ -4396,7 +4399,7 @@ START_TEST(test_sysdb_subdomain_store_user)
fail_unless(ldb_dn_compare(results->msgs[0]->dn, check_dn) == 0,
"Unexpedted DN returned");
- ret = sysdb_delete_user(subdomain->sysdb, "subdomuser", 0);
+ ret = sysdb_delete_user(subdomain->sysdb, subdomain, "subdomuser", 0);
fail_unless(ret == EOK, "sysdb_delete_user failed [%d][%s].",
ret, strerror(ret));
@@ -4454,7 +4457,7 @@ START_TEST(test_sysdb_subdomain_user_ops)
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
"Unexpedted DN returned");
- ret = sysdb_delete_domuser(subdomain, "subdomuser", 12345);
+ ret = sysdb_delete_user(subdomain->sysdb, subdomain, "subdomuser", 12345);
fail_unless(ret == EOK, "sysdb_delete_domuser failed with [%d][%s].",
ret, strerror(ret));