summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-21 00:52:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:16 -0400
commite5e32021c23f3726d68ee756e8e3de48b3214063 (patch)
treec2a04ab91bd3d21637ce4c3629d4685e27b64274
parentaacf8781c61e928c74fcc89f02225374b283b872 (diff)
downloadsssd-e5e32021c23f3726d68ee756e8e3de48b3214063.tar.gz
sssd-e5e32021c23f3726d68ee756e8e3de48b3214063.tar.bz2
sssd-e5e32021c23f3726d68ee756e8e3de48b3214063.zip
sysdb: remove remaining traces of sysdb_handle
-rw-r--r--src/db/sysdb.c193
-rw-r--r--src/db/sysdb.h3
-rw-r--r--src/db/sysdb_private.h26
-rw-r--r--src/providers/ipa/ipa_access.c4
-rw-r--r--src/providers/ldap/sdap_async_accounts.c2
-rw-r--r--src/python/pysss.c1
-rw-r--r--src/responder/pam/pam_LOCAL_domain.c1
-rw-r--r--src/tests/sysdb-tests.c1
-rw-r--r--src/tools/sss_groupshow.c5
-rw-r--r--src/tools/sss_sync_ops.c1
-rw-r--r--src/tools/tools_util.h1
11 files changed, 1 insertions, 237 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 22051da3..1d86c4b3 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -63,16 +63,6 @@ struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx)
return ctx->ldb;
}
-struct ldb_context *sysdb_handle_get_ldb(struct sysdb_handle *handle)
-{
- return handle->ctx->ldb;
-}
-
-struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle)
-{
- return handle->ctx;
-}
-
struct sysdb_attrs *sysdb_new_attrs(TALLOC_CTX *memctx)
{
return talloc_zero(memctx, struct sysdb_attrs);
@@ -418,117 +408,6 @@ int sysdb_error_to_errno(int ldberr)
}
}
-/* =Internal-Operations-Queue============================================= */
-
-static void sysdb_run_operation(struct tevent_context *ev,
- struct tevent_timer *te,
- struct timeval tv, void *pvt)
-{
- struct sysdb_handle *handle = talloc_get_type(pvt, struct sysdb_handle);
-
- tevent_req_done(handle->subreq);
-}
-
-static void sysdb_schedule_operation(struct sysdb_handle *handle)
-{
- struct timeval tv = { 0, 0 };
- struct tevent_timer *te;
-
- te = tevent_add_timer(handle->ctx->ev, handle, tv,
- sysdb_run_operation, handle);
- if (!te) {
- DEBUG(1, ("Failed to add critical timer to run next handle!\n"));
- }
-}
-
-static int sysdb_handle_destructor(void *mem)
-{
- struct sysdb_handle *handle = talloc_get_type(mem, struct sysdb_handle);
- bool start_next = false;
- int ret;
-
- /* if this was the current op start next */
- if (handle->ctx->queue == handle) {
- start_next = true;
- }
-
- DLIST_REMOVE(handle->ctx->queue, handle);
-
- if (start_next && handle->ctx->queue) {
- /* run next */
- sysdb_schedule_operation(handle->ctx->queue);
- }
-
- if (handle->transaction_active) {
- ret = ldb_transaction_cancel(handle->ctx->ldb);
- if (ret != LDB_SUCCESS) {
- DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret));
- }
- /* FIXME: abort() ? */
- handle->transaction_active = false;
- }
-
- return 0;
-}
-
-struct sysdb_get_handle_state {
- struct tevent_context *ev;
- struct sysdb_ctx *ctx;
-
- struct sysdb_handle *handle;
-};
-
-struct tevent_req *sysdb_get_handle_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx)
-{
- struct tevent_req *req;
- struct sysdb_get_handle_state *state;
- struct sysdb_handle *handle;
-
- req = tevent_req_create(mem_ctx, &state, struct sysdb_get_handle_state);
- if (!req) return NULL;
-
- state->ev = ev;
- state->ctx = ctx;
-
- handle = talloc_zero(state, struct sysdb_handle);
- if (!handle) {
- talloc_zfree(req);
- return NULL;
- }
-
- handle->ctx = ctx;
- handle->subreq = req;
-
- talloc_set_destructor((TALLOC_CTX *)handle, sysdb_handle_destructor);
-
- DLIST_ADD_END(ctx->queue, handle, struct sysdb_handle *);
-
- if (ctx->queue == handle) {
- /* this is the first in the queue, schedule an immediate run */
- sysdb_schedule_operation(handle);
- }
-
- state->handle = handle;
-
- return req;
-}
-
-static int sysdb_get_handle_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle)
-{
- struct sysdb_get_handle_state *state = tevent_req_data(req,
- struct sysdb_get_handle_state);
-
- TEVENT_REQ_RETURN_ON_ERROR(req);
-
- *handle = talloc_steal(memctx, state->handle);
- if (!*handle) return ENOMEM;
-
- return EOK;
-}
-
/* =Transactions========================================================== */
int sysdb_transaction_start(struct sysdb_ctx *ctx)
@@ -564,78 +443,6 @@ int sysdb_transaction_cancel(struct sysdb_ctx *ctx)
return sysdb_error_to_errno(ret);
}
-/* =Operations============================================================ */
-
-struct sysdb_operation_state {
- struct tevent_context *ev;
- struct sysdb_ctx *ctx;
-
- struct sysdb_handle *handle;
-};
-
-static void sysdb_operation_process(struct tevent_req *subreq);
-
-struct tevent_req *sysdb_operation_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx)
-{
- struct tevent_req *req, *subreq;
- struct sysdb_operation_state *state;
-
- req = tevent_req_create(mem_ctx, &state, struct sysdb_operation_state);
- if (!req) return NULL;
-
- state->ev = ev;
- state->ctx = ctx;
-
- subreq = sysdb_get_handle_send(state, ev, ctx);
- if (!subreq) {
- talloc_zfree(req);
- return NULL;
- }
-
- tevent_req_set_callback(subreq, sysdb_operation_process, req);
-
- return req;
-}
-
-static void sysdb_operation_process(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct sysdb_operation_state *state = tevent_req_data(req,
- struct sysdb_operation_state);
- int ret;
-
- ret = sysdb_get_handle_recv(subreq, state, &state->handle);
- talloc_zfree(subreq);
- if (ret) {
- tevent_req_error(req, ret);
- return;
- }
-
- tevent_req_done(req);
-}
-
-int sysdb_operation_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle)
-{
- struct sysdb_operation_state *state = tevent_req_data(req,
- struct sysdb_operation_state);
-
- TEVENT_REQ_RETURN_ON_ERROR(req);
-
- *handle = talloc_steal(memctx, state->handle);
- if (!*handle) return ENOMEM;
-
- return EOK;
-}
-
-void sysdb_operation_done(struct sysdb_handle *handle)
-{
- talloc_free(handle);
-}
-
/* =Initialization======================================================== */
static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 87a5ec56..65e72141 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -147,7 +147,6 @@
struct confdb_ctx;
struct sysdb_ctx_list;
struct sysdb_ctx;
-struct sysdb_handle;
struct sysdb_attrs {
int num;
@@ -212,8 +211,6 @@ char *sysdb_group_strdn(TALLOC_CTX *memctx,
struct ldb_context *sysdb_ctx_get_ldb(struct sysdb_ctx *ctx);
-struct ldb_context *sysdb_handle_get_ldb(struct sysdb_handle *handle);
-struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle);
int compare_ldb_dn_comp_num(const void *m1, const void *m2);
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
index 270cf360..e5494bd6 100644
--- a/src/db/sysdb_private.h
+++ b/src/db/sysdb_private.h
@@ -61,16 +61,6 @@
#include "db/sysdb.h"
-struct sysdb_handle {
- struct sysdb_handle *prev;
- struct sysdb_handle *next;
-
- struct sysdb_ctx *ctx;
- struct tevent_req *subreq;
-
- bool transaction_active;
-};
-
struct sysdb_ctx {
struct tevent_context *ev;
@@ -79,8 +69,6 @@ struct sysdb_ctx {
struct ldb_context *ldb;
char *ldb_file;
-
- struct sysdb_handle *queue;
};
struct sysdb_ctx_list {
@@ -90,18 +78,4 @@ struct sysdb_ctx_list {
char *db_path;
};
-/* An operation blocks the transaction queue as well, but does not
- * start a transaction, normally useful only for search type calls.
- * do *NOT* call within a transaction you'll deadlock sysdb.
- * Also make sure to free the handle as soon as the operation is
- * finished to avoid stalling or potentially deadlocking sysdb */
-
-struct tevent_req *sysdb_operation_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct sysdb_ctx *ctx);
-int sysdb_operation_recv(struct tevent_req *req, TALLOC_CTX *memctx,
- struct sysdb_handle **handle);
-
-void sysdb_operation_done(struct sysdb_handle *handle);
-
#endif /* __INT_SYS_DB_H__ */
diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index 2d47f8b2..a7058bad 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -211,7 +211,6 @@ struct hbac_get_host_info_state {
struct tevent_context *ev;
struct sdap_id_ctx *sdap_ctx;
struct sysdb_ctx *sysdb;
- struct sysdb_handle *handle;
bool offline;
char *host_filter;
@@ -257,7 +256,6 @@ static struct tevent_req *hbac_get_host_info_send(TALLOC_CTX *memctx,
state->ev = ev;
state->sdap_ctx = sdap_ctx;
state->sysdb = sysdb;
- state->handle = NULL;
state->offline = offline;
state->host_reply_list = NULL;
@@ -649,7 +647,6 @@ struct hbac_get_rules_state {
struct tevent_context *ev;
struct sdap_id_ctx *sdap_ctx;
struct sysdb_ctx *sysdb;
- struct sysdb_handle *handle;
bool offline;
const char *host_dn;
@@ -699,7 +696,6 @@ static struct tevent_req *hbac_get_rules_send(TALLOC_CTX *memctx,
state->offline = offline;
state->sdap_ctx = sdap_ctx;
state->sysdb = sysdb;
- state->handle = NULL;
state->host_dn = host_dn;
state->memberof = memberof;
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 9dca9eb0..bdaa9e9e 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -1302,8 +1302,6 @@ struct sdap_get_initgr_state {
const char **grp_attrs;
struct sysdb_attrs *orig_user;
-
- struct sysdb_handle *handle;
};
static void sdap_get_initgr_user(struct tevent_req *subreq);
diff --git a/src/python/pysss.c b/src/python/pysss.c
index cd5c588f..8fa9b9d0 100644
--- a/src/python/pysss.c
+++ b/src/python/pysss.c
@@ -89,7 +89,6 @@ struct py_sss_transaction {
PySssLocalObject *self;
struct ops_ctx *ops;
- struct sysdb_handle *handle;
bool transaction_done;
int error;
};
diff --git a/src/responder/pam/pam_LOCAL_domain.c b/src/responder/pam/pam_LOCAL_domain.c
index a17934ce..d6c532e0 100644
--- a/src/responder/pam/pam_LOCAL_domain.c
+++ b/src/responder/pam/pam_LOCAL_domain.c
@@ -50,7 +50,6 @@ struct LOCAL_request {
struct tevent_context *ev;
struct sysdb_ctx *dbctx;
struct sysdb_attrs *mod_attrs;
- struct sysdb_handle *handle;
struct ldb_result *res;
int error;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 2a84da94..10d77ff4 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -161,7 +161,6 @@ static int setup_sysdb_tests(struct sysdb_test_ctx **ctx)
struct test_data {
struct tevent_context *ev;
- struct sysdb_handle *handle;
struct sysdb_test_ctx *ctx;
const char *username;
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index b6fb1a15..3f72fcef 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -267,7 +267,6 @@ done:
struct group_show_state {
struct tevent_context *ev;
struct sysdb_ctx *sysdb;
- struct sysdb_handle *handle;
struct sss_domain_info *domain;
struct group_info *root;
@@ -294,7 +293,6 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx,
struct tevent_req *group_show_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct sysdb_ctx *sysdb,
- struct sysdb_handle *handle,
struct sss_domain_info *domain,
bool recursive,
const char *name)
@@ -315,7 +313,6 @@ struct tevent_req *group_show_send(TALLOC_CTX *mem_ctx,
}
state->ev = ev;
state->sysdb = sysdb;
- state->handle = handle;
state->domain = domain;
state->recursive = recursive;
@@ -876,7 +873,7 @@ int main(int argc, const char **argv)
goto fini;
}
- req = group_show_send(tctx, tctx->ev, tctx->sysdb, tctx->handle,
+ req = group_show_send(tctx, tctx->ev, tctx->sysdb,
tctx->local, pc_recursive, tctx->octx->name);
if (!req) {
ERROR("Cannot initiate search\n");
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index f3721a01..59e5c604 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -114,7 +114,6 @@ done:
struct user_mod_state {
struct tevent_context *ev;
struct sysdb_ctx *sysdb;
- struct sysdb_handle *handle;
struct sysdb_attrs *attrs;
struct ldb_dn *member_dn;
diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h
index ac882868..2996f5c1 100644
--- a/src/tools/tools_util.h
+++ b/src/tools/tools_util.h
@@ -47,7 +47,6 @@ struct tools_ctx {
struct ops_ctx *octx;
- struct sysdb_handle *handle;
bool transaction_done;
int error;
};