diff options
-rw-r--r-- | src/db/sysdb.h | 9 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 74 | ||||
-rw-r--r-- | src/providers/proxy.c | 108 | ||||
-rw-r--r-- | src/python/pysss.c | 47 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 38 | ||||
-rw-r--r-- | src/tools/sss_groupdel.c | 17 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 227 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.h | 4 | ||||
-rw-r--r-- | src/tools/sss_userdel.c | 7 |
9 files changed, 101 insertions, 430 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index cf97ed62..2fa1c7f9 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -331,12 +331,9 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx, * See sysdb_transaction_send()/_recv() */ /* Delete Entry */ -struct tevent_req *sysdb_delete_entry_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct sysdb_handle *handle, - struct ldb_dn *dn, - bool ignore_not_found); -int sysdb_delete_entry_recv(struct tevent_req *req); +int sysdb_delete_entry(struct sysdb_ctx *ctx, + struct ldb_dn *dn, + bool ignore_not_found); struct tevent_req *sysdb_delete_recursive_send(TALLOC_CTX *mem_ctx, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 618b8108..248ebfb6 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -251,6 +251,29 @@ static int sysdb_op_default_recv(struct tevent_req *req) /* =Remove-Entry-From-Sysdb=============================================== */ +int sysdb_delete_entry(struct sysdb_ctx *ctx, + struct ldb_dn *dn, + bool ignore_not_found) +{ + int ret; + + ret = ldb_delete(ctx->ldb, dn); + switch (ret) { + case LDB_SUCCESS: + return EOK; + case LDB_ERR_NO_SUCH_OBJECT: + if (ignore_not_found) { + return EOK; + } + /* fall through */ + default: + DEBUG(1, ("LDB Error: %s(%d)\nError Message: [%s]\n", + ldb_strerror(ret), ret, ldb_errstring(ctx->ldb))); + return sysdb_error_to_errno(ret); + } +} + +static struct tevent_req *sysdb_delete_entry_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct sysdb_handle *handle, @@ -294,12 +317,12 @@ fail: return req; } +static int sysdb_delete_entry_recv(struct tevent_req *req) { return sysdb_op_default_recv(req); } - /* =Remove-Subentries-From-Sysdb=============================================== */ struct sysdb_delete_recursive_state { @@ -4218,7 +4241,6 @@ struct sysdb_delete_user_state { }; void sysdb_delete_user_check_handle(struct tevent_req *subreq); -static void sysdb_delete_user_found(struct tevent_req *subreq); static void sysdb_delete_user_done(struct tevent_req *subreq); struct tevent_req *sysdb_delete_user_send(TALLOC_CTX *mem_ctx, @@ -4282,10 +4304,10 @@ void sysdb_delete_user_check_handle(struct tevent_req *subreq) tevent_req_error(req, ENOMEM); return; } - tevent_req_set_callback(subreq, sysdb_delete_user_found, req); + tevent_req_set_callback(subreq, sysdb_delete_user_done, req); } -static void sysdb_delete_user_found(struct tevent_req *subreq) +static void sysdb_delete_user_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); @@ -4320,24 +4342,7 @@ static void sysdb_delete_user_found(struct tevent_req *subreq) } } - subreq = sysdb_delete_entry_send(state, state->ev, - state->handle, msg->dn, false); - if (!subreq) { - DEBUG(6, ("Error: Out of memory\n")); - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(subreq, sysdb_delete_user_done, req); -} - -static void sysdb_delete_user_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); + ret = sysdb_delete_entry(state->handle->ctx, msg->dn, false); if (ret) { tevent_req_error(req, ret); return; @@ -4502,8 +4507,6 @@ struct sysdb_delete_group_state { }; void sysdb_delete_group_check_handle(struct tevent_req *subreq); -static void sysdb_delete_group_found(struct tevent_req *subreq); -static void sysdb_delete_group_done(struct tevent_req *subreq); struct tevent_req *sysdb_delete_group_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -4566,10 +4569,10 @@ void sysdb_delete_group_check_handle(struct tevent_req *subreq) tevent_req_error(req, ENOMEM); return; } - tevent_req_set_callback(subreq, sysdb_delete_group_found, req); + tevent_req_set_callback(subreq, sysdb_delete_group_done, req); } -static void sysdb_delete_group_found(struct tevent_req *subreq) +static void sysdb_delete_group_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); @@ -4604,24 +4607,7 @@ static void sysdb_delete_group_found(struct tevent_req *subreq) } } - subreq = sysdb_delete_entry_send(state, state->ev, - state->handle, msg->dn, false); - if (!subreq) { - DEBUG(6, ("Error: Out of memory\n")); - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(subreq, sysdb_delete_group_done, req); -} - -static void sysdb_delete_group_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); + ret = sysdb_delete_entry(state->handle->ctx, msg->dn, false); if (ret) { tevent_req_error(req, ret); return; diff --git a/src/providers/proxy.c b/src/providers/proxy.c index 547c0e32..84a966a2 100644 --- a/src/providers/proxy.c +++ b/src/providers/proxy.c @@ -345,7 +345,6 @@ static int proxy_default_recv(struct tevent_req *req) /* =Getpwnam-wrapper======================================================*/ static void get_pw_name_process(struct tevent_req *subreq); -static void get_pw_name_remove_done(struct tevent_req *subreq); static void get_pw_name_add_done(struct tevent_req *subreq); static struct tevent_req *get_pw_name_send(TALLOC_CTX *mem_ctx, @@ -467,10 +466,7 @@ static void get_pw_name_process(struct tevent_req *subreq) return; default: - DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n", - state->name, status)); - tevent_req_error(req, EIO); - return; + break; } if (delete_user) { @@ -486,39 +482,27 @@ static void get_pw_name_process(struct tevent_req *subreq) return; } - subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true); + ret = sysdb_delete_entry(state->sysdb, dn, true); + if (ret) { + tevent_req_error(req, ret); + return; + } + + subreq = sysdb_transaction_commit_send(state, state->ev, state->handle); if (!subreq) { tevent_req_error(req, ENOMEM); return; } - tevent_req_set_callback(subreq, get_pw_name_remove_done, req); - } -} - -static void get_pw_name_add_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - struct proxy_state *state = tevent_req_data(req, - struct proxy_state); - int ret; - - ret = sysdb_store_user_recv(subreq); - talloc_zfree(subreq); - if (ret) { - tevent_req_error(req, ret); + tevent_req_set_callback(subreq, proxy_default_done, req); return; } - subreq = sysdb_transaction_commit_send(state, state->ev, state->handle); - if (!subreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(subreq, proxy_default_done, req); + DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n", + state->name, status)); + tevent_req_error(req, EIO); } -static void get_pw_name_remove_done(struct tevent_req *subreq) +static void get_pw_name_add_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); @@ -526,7 +510,7 @@ static void get_pw_name_remove_done(struct tevent_req *subreq) struct proxy_state); int ret; - ret = sysdb_delete_entry_recv(subreq); + ret = sysdb_store_user_recv(subreq); talloc_zfree(subreq); if (ret) { tevent_req_error(req, ret); @@ -926,7 +910,6 @@ fail: } while(0) static void get_gr_name_process(struct tevent_req *subreq); -static void get_gr_name_remove_done(struct tevent_req *subreq); static void get_gr_name_add_done(struct tevent_req *subreq); static struct tevent_req *get_gr_name_send(TALLOC_CTX *mem_ctx, @@ -1083,10 +1066,7 @@ again: return; default: - DEBUG(2, ("proxy -> getgrnam_r failed for '%s' <%d>\n", - state->name, status)); - tevent_req_error(req, EIO); - return; + break; } if (delete_group) { @@ -1102,39 +1082,27 @@ again: return; } - subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true); + ret = sysdb_delete_entry(state->sysdb, dn, true); + if (ret) { + tevent_req_error(req, ret); + return; + } + + subreq = sysdb_transaction_commit_send(state, state->ev, state->handle); if (!subreq) { tevent_req_error(req, ENOMEM); return; } - tevent_req_set_callback(subreq, get_gr_name_remove_done, req); - } -} - -static void get_gr_name_add_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - struct proxy_state *state = tevent_req_data(req, - struct proxy_state); - int ret; - - ret = sysdb_store_group_recv(subreq); - talloc_zfree(subreq); - if (ret) { - tevent_req_error(req, ret); + tevent_req_set_callback(subreq, proxy_default_done, req); return; } - subreq = sysdb_transaction_commit_send(state, state->ev, state->handle); - if (!subreq) { - tevent_req_error(req, ENOMEM); - return; - } - tevent_req_set_callback(subreq, proxy_default_done, req); + DEBUG(2, ("proxy -> getgrnam_r failed for '%s' <%d>\n", + state->name, status)); + tevent_req_error(req, EIO); } -static void get_gr_name_remove_done(struct tevent_req *subreq) +static void get_gr_name_add_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); @@ -1142,7 +1110,7 @@ static void get_gr_name_remove_done(struct tevent_req *subreq) struct proxy_state); int ret; - ret = sysdb_delete_entry_recv(subreq); + ret = sysdb_store_group_recv(subreq); talloc_zfree(subreq); if (ret) { tevent_req_error(req, ret); @@ -1707,10 +1675,7 @@ static void get_initgr_process(struct tevent_req *subreq) return; default: - DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n", - state->name, status)); - tevent_req_error(req, EIO); - return; + break; } if (delete_user) { @@ -1723,13 +1688,24 @@ static void get_initgr_process(struct tevent_req *subreq) return; } - subreq = sysdb_delete_entry_send(state, state->ev, state->handle, dn, true); + ret = sysdb_delete_entry(state->sysdb, dn, true); + if (ret) { + tevent_req_error(req, ret); + return; + } + + subreq = sysdb_transaction_commit_send(state, state->ev, state->handle); if (!subreq) { tevent_req_error(req, ENOMEM); return; } - tevent_req_set_callback(subreq, get_pw_name_remove_done, req); + tevent_req_set_callback(subreq, proxy_default_done, req); + return; } + + DEBUG(2, ("proxy -> getpwnam_r failed for '%s' <%d>\n", + state->name, status)); + tevent_req_error(req, EIO); } static void get_initgr_groups_process(struct tevent_req *subreq) diff --git a/src/python/pysss.c b/src/python/pysss.c index 7c84c21e..bd6d16e3 100644 --- a/src/python/pysss.c +++ b/src/python/pysss.c @@ -385,27 +385,10 @@ static PyObject *py_sss_userdel(PySssLocalObject *self, } } - /* Delete the user within a transaction */ - start_transaction(tctx); - if (tctx->error != EOK) { - PyErr_SetSssError(tctx->error); - goto fail; - } - - ret = userdel(tctx, self->ev, - self->sysdb, tctx->handle, tctx->octx); + /* Delete the user */ + ret = userdel(tctx, self->sysdb, tctx->octx); if (ret != EOK) { - tctx->error = ret; - - /* cancel transaction */ - talloc_zfree(tctx->handle); - PyErr_SetSssError(tctx->error); - goto fail; - } - - end_transaction(tctx); - if (tctx->error) { - PyErr_SetSssError(tctx->error); + PyErr_SetSssError(ret); goto fail; } @@ -653,28 +636,10 @@ static PyObject *py_sss_groupdel(PySssLocalObject *self, tctx->octx->name = groupname; - /* Remove the group within a transaction */ - start_transaction(tctx); - if (tctx->error != EOK) { - PyErr_SetSssError(tctx->error); - goto fail; - } - - /* groupdel */ - ret = groupdel(tctx, self->ev, - self->sysdb, tctx->handle, tctx->octx); + /* Remove the group */ + ret = groupdel(tctx, self->sysdb, tctx->octx); if (ret != EOK) { - tctx->error = ret; - - /* cancel transaction */ - talloc_zfree(tctx->handle); - PyErr_SetSssError(tctx->error); - goto fail; - } - - end_transaction(tctx); - if (tctx->error) { - PyErr_SetSssError(tctx->error); + PyErr_SetSssError(ret); goto fail; } diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index c6661aef..c6b1e5cf 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -306,13 +306,10 @@ static void test_store_user_done(struct tevent_req *subreq) return test_return(data, ret); } -static void test_remove_user_done(struct tevent_req *subreq); - static void test_remove_user(struct tevent_req *req) { struct test_data *data = tevent_req_callback_data(req, struct test_data); struct ldb_dn *user_dn; - struct tevent_req *subreq; int ret; ret = sysdb_transaction_recv(req, data, &data->handle); @@ -323,21 +320,7 @@ static void test_remove_user(struct tevent_req *req) user_dn = sysdb_user_dn(data->ctx->sysdb, data, "LOCAL", data->username); if (!user_dn) return test_return(data, ENOMEM); - subreq = sysdb_delete_entry_send(data, data->ev, data->handle, user_dn, true); - if (!subreq) return test_return(data, ENOMEM); - - tevent_req_set_callback(subreq, test_remove_user_done, data); -} - -static void test_remove_user_done(struct tevent_req *subreq) -{ - struct test_data *data = tevent_req_callback_data(subreq, - struct test_data); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); - + ret = sysdb_delete_entry(data->ctx->sysdb, user_dn, true); return test_return(data, ret); } @@ -511,12 +494,9 @@ static void test_store_group_done(struct tevent_req *subreq) return test_return(data, ret); } -static void test_remove_group_done(struct tevent_req *subreq); - static void test_remove_group(struct tevent_req *req) { struct test_data *data = tevent_req_callback_data(req, struct test_data); - struct tevent_req *subreq; struct ldb_dn *group_dn; int ret; @@ -528,21 +508,7 @@ static void test_remove_group(struct tevent_req *req) group_dn = sysdb_group_dn(data->ctx->sysdb, data, "LOCAL", data->groupname); if (!group_dn) return test_return(data, ENOMEM); - subreq = sysdb_delete_entry_send(data, data->ev, data->handle, group_dn, true); - if (!subreq) return test_return(data, ENOMEM); - - tevent_req_set_callback(subreq, test_remove_group_done, data); -} - -static void test_remove_group_done(struct tevent_req *subreq) -{ - struct test_data *data = tevent_req_callback_data(subreq, - struct test_data); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); - + ret = sysdb_delete_entry(data->ctx->sysdb, group_dn, true); return test_return(data, ret); } diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index e5b043e2..32335571 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -110,24 +110,9 @@ int main(int argc, const char **argv) goto fini; } - start_transaction(tctx); - if (tctx->error != EOK) { - goto done; - } - /* groupdel */ - ret = groupdel(tctx, tctx->ev, tctx->sysdb, tctx->handle, tctx->octx); - if (ret != EOK) { - tctx->error = ret; - - /* cancel transaction */ - talloc_zfree(tctx->handle); - goto done; - } - - end_transaction(tctx); + ret = groupdel(tctx, tctx->sysdb, tctx->octx); - ret = tctx->error; done: if (ret) { DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 498be284..7feeedf2 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -397,80 +397,6 @@ static int user_add_recv(struct tevent_req *req) } /* - * Remove a user - */ -struct user_del_state { - struct tevent_context *ev; - struct sysdb_ctx *sysdb; - struct sysdb_handle *handle; - - struct ops_ctx *data; -}; - -static void user_del_done(struct tevent_req *subreq); - -static struct tevent_req *user_del_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, - struct ops_ctx *data) -{ - struct user_del_state *state = NULL; - struct tevent_req *req; - struct tevent_req *subreq; - struct ldb_dn *user_dn; - - req = tevent_req_create(mem_ctx, &state, struct user_del_state); - if (req == NULL) { - talloc_zfree(req); - return NULL; - } - state->ev = ev; - state->sysdb = sysdb; - state->handle = handle; - state->data = data; - - user_dn = sysdb_user_dn(state->sysdb, state, - state->data->domain->name, state->data->name); - if (!user_dn) { - DEBUG(1, ("Could not construct a user DN\n")); - return NULL; - } - - subreq = sysdb_delete_entry_send(state, - state->ev, state->handle, - user_dn, false); - if (!subreq) { - talloc_zfree(req); - return NULL; - } - - tevent_req_set_callback(subreq, user_del_done, req); - return req; -} - -static void user_del_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); - if (ret) { - tevent_req_error(req, ret); - return; - } - - return tevent_req_done(req); -} - -static int user_del_recv(struct tevent_req *req) -{ - return sync_ops_recv(req); -} - -/* * Modify a user */ struct user_mod_state { @@ -827,81 +753,6 @@ static int group_add_recv(struct tevent_req *req) } /* - * Delete a group - */ -struct group_del_state { - struct tevent_context *ev; - struct sysdb_ctx *sysdb; - struct sysdb_handle *handle; - struct sysdb_attrs *attrs; - - struct ops_ctx *data; -}; - -static void group_del_done(struct tevent_req *subreq); - -static struct tevent_req *group_del_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, - struct ops_ctx *data) -{ - struct group_del_state *state = NULL; - struct tevent_req *req; - struct tevent_req *subreq; - struct ldb_dn *group_dn; - - req = tevent_req_create(mem_ctx, &state, struct group_del_state); - if (req == NULL) { - talloc_zfree(req); - return NULL; - } - state->ev = ev; - state->sysdb = sysdb; - state->handle = handle; - state->data = data; - - group_dn = sysdb_group_dn(state->sysdb, state, - state->data->domain->name, state->data->name); - if (group_dn == NULL) { - DEBUG(1, ("Could not construct a group DN\n")); - return NULL; - } - - subreq = sysdb_delete_entry_send(state, - state->ev, state->handle, - group_dn, false); - if (!subreq) { - talloc_zfree(req); - return NULL; - } - - tevent_req_set_callback(subreq, group_del_done, req); - return req; -} - -static void group_del_done(struct tevent_req *subreq) -{ - struct tevent_req *req = tevent_req_callback_data(subreq, - struct tevent_req); - int ret; - - ret = sysdb_delete_entry_recv(subreq); - talloc_zfree(subreq); - if (ret) { - tevent_req_error(req, ret); - return; - } - - return tevent_req_done(req); -} - -static int group_del_recv(struct tevent_req *req) -{ - return sync_ops_recv(req); -} - -/* * Modify a group */ struct group_mod_state { @@ -1327,54 +1178,31 @@ static void useradd_done(struct tevent_req *req) /* * Public interface for deleting users */ -static void userdel_done(struct tevent_req *req); - int userdel(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, struct ops_ctx *data) { + struct ldb_dn *user_dn; int ret; - struct tevent_req *req; - struct sync_op_res *res = NULL; - res = talloc_zero(mem_ctx, struct sync_op_res); - if (!res) { + user_dn = sysdb_user_dn(sysdb, mem_ctx, + data->domain->name, data->name); + if (!user_dn) { + DEBUG(1, ("Could not construct a user DN\n")); return ENOMEM; } - req = user_del_send(res, ev, sysdb, handle, data); - if (!req) { - return ENOMEM; + ret = sysdb_delete_entry(sysdb, user_dn, false); + if (ret) { + DEBUG(2, ("Removing user failed: %s (%d)\n", strerror(ret), ret)); } - tevent_req_set_callback(req, userdel_done, res); - - SYNC_LOOP(res, ret); flush_nscd_cache(mem_ctx, NSCD_DB_PASSWD); flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); - talloc_free(res); return ret; } -static void userdel_done(struct tevent_req *req) -{ - int ret; - struct sync_op_res *res = tevent_req_callback_data(req, - struct sync_op_res); - - ret = user_del_recv(req); - talloc_free(req); - if (ret) { - DEBUG(2, ("Removing user failed: %s (%d)\n", strerror(ret), ret)); - } - - res->done = true; - res->error = ret; -} - /* * Public interface for modifying users */ @@ -1479,53 +1307,30 @@ static void groupadd_done(struct tevent_req *req) /* * Public interface for deleting groups */ -static void groupdel_done(struct tevent_req *req); - int groupdel(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, struct ops_ctx *data) { + struct ldb_dn *group_dn; int ret; - struct tevent_req *req; - struct sync_op_res *res = NULL; - res = talloc_zero(mem_ctx, struct sync_op_res); - if (!res) { + group_dn = sysdb_group_dn(sysdb, mem_ctx, + data->domain->name, data->name); + if (group_dn == NULL) { + DEBUG(1, ("Could not construct a group DN\n")); return ENOMEM; } - req = group_del_send(res, ev, sysdb, handle, data); - if (!req) { - return ENOMEM; + ret = sysdb_delete_entry(sysdb, group_dn, false); + if (ret) { + DEBUG(2, ("Removing group failed: %s (%d)\n", strerror(ret), ret)); } - tevent_req_set_callback(req, groupdel_done, res); - - SYNC_LOOP(res, ret); flush_nscd_cache(mem_ctx, NSCD_DB_GROUP); - talloc_free(res); return ret; } -static void groupdel_done(struct tevent_req *req) -{ - int ret; - struct sync_op_res *res = tevent_req_callback_data(req, - struct sync_op_res); - - ret = group_del_recv(req); - talloc_free(req); - if (ret) { - DEBUG(2, ("Removing group failed: %s (%d)\n", strerror(ret), ret)); - } - - res->done = true; - res->error = ret; -} - /* * Public interface for modifying groups */ diff --git a/src/tools/sss_sync_ops.h b/src/tools/sss_sync_ops.h index 383319a8..6629d9c9 100644 --- a/src/tools/sss_sync_ops.h +++ b/src/tools/sss_sync_ops.h @@ -78,9 +78,7 @@ int useradd(TALLOC_CTX *mem_ctx, struct sysdb_handle *handle, struct ops_ctx *data); int userdel(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, struct ops_ctx *data); int usermod(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -94,9 +92,7 @@ int groupadd(TALLOC_CTX *mem_ctx, struct sysdb_handle *handle, struct ops_ctx *data); int groupdel(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, struct sysdb_ctx *sysdb, - struct sysdb_handle *handle, struct ops_ctx *data); int groupmod(TALLOC_CTX *mem_ctx, struct tevent_context *ev, diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c index 464c22e7..890b4fec 100644 --- a/src/tools/sss_userdel.c +++ b/src/tools/sss_userdel.c @@ -267,12 +267,8 @@ int main(int argc, const char **argv) } /* userdel */ - ret = userdel(tctx, tctx->ev, tctx->sysdb, tctx->handle, tctx->octx); + ret = userdel(tctx, tctx->sysdb, tctx->octx); if (ret != EOK) { - tctx->error = ret; - - /* cancel transaction */ - talloc_zfree(tctx->handle); goto done; } @@ -331,7 +327,6 @@ int main(int argc, const char **argv) } } - ret = tctx->error; done: if (ret) { DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret))); |