summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-21 02:18:48 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:17 -0400
commitd86fc9163127f7c5bd0c3af950fcddff7911867f (patch)
tree87616d3c52142d15be2149ba7f42bd6d20551214
parent9fc354f7deb3f0de84f0403ec4f212ca18b5e8e8 (diff)
downloadsssd-d86fc9163127f7c5bd0c3af950fcddff7911867f.tar.gz
sssd-d86fc9163127f7c5bd0c3af950fcddff7911867f.tar.bz2
sssd-d86fc9163127f7c5bd0c3af950fcddff7911867f.zip
tools: remove creation of event_context
Since the sysdb is now synchronous and creates its own event context we don't need an explicit event context anymore in the tools.
-rw-r--r--src/python/pysss.c21
-rw-r--r--src/tools/sss_groupdel.c2
-rw-r--r--src/tools/sss_groupmod.c2
-rw-r--r--src/tools/sss_sync_ops.c10
-rw-r--r--src/tools/sss_sync_ops.h2
-rw-r--r--src/tools/sss_useradd.c1
-rw-r--r--src/tools/sss_userdel.c1
-rw-r--r--src/tools/sss_usermod.c2
-rw-r--r--src/tools/tools_util.c8
-rw-r--r--src/tools/tools_util.h1
10 files changed, 3 insertions, 47 deletions
diff --git a/src/python/pysss.c b/src/python/pysss.c
index 7801be5e..36bae264 100644
--- a/src/python/pysss.c
+++ b/src/python/pysss.c
@@ -29,17 +29,6 @@
#include "tools/tools_util.h"
#include "tools/sss_sync_ops.h"
-#define TRANSACTION_WAIT(trs, retval) do { \
- while (!trs->transaction_done) { \
- tevent_loop_once(trs->self->ev); \
- } \
- retval = trs->error; \
- if (retval) { \
- PyErr_SetSssError(retval); \
- goto fail; \
- } \
-} while(0)
-
/*
* function taken from samba sources tree as of Aug 20 2009,
* file source4/lib/ldb/pyldb.c
@@ -124,7 +113,6 @@ struct tools_ctx *init_ctx(TALLOC_CTX *mem_ctx,
return NULL;
}
- tctx->ev = self->ev;
tctx->confdb = self->confdb;
tctx->sysdb = self->sysdb;
tctx->local = self->local;
@@ -263,7 +251,6 @@ static PyObject *py_sss_useradd(PySssLocalObject *self,
* sysdb did assign it automatically, do a lookup */
if (tctx->octx->uid == 0 || tctx->octx->gid == 0) {
ret = sysdb_getpwnam_sync(tctx,
- tctx->ev,
tctx->sysdb,
tctx->octx->name,
tctx->local,
@@ -370,7 +357,6 @@ static PyObject *py_sss_userdel(PySssLocalObject *self,
if (tctx->octx->remove_homedir) {
ret = sysdb_getpwnam_sync(tctx,
- tctx->ev,
tctx->sysdb,
tctx->octx->name,
tctx->local,
@@ -771,13 +757,6 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type,
}
self->mem_ctx = mem_ctx;
- self->ev = tevent_context_init(mem_ctx);
- if (self->ev == NULL) {
- talloc_free(mem_ctx);
- PyErr_SetSssErrorWithMessage(EIO, "Cannot create event context");
- return NULL;
- }
-
confdb_path = talloc_asprintf(self->mem_ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
talloc_free(mem_ctx);
diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c
index fe7e7309..006ed09c 100644
--- a/src/tools/sss_groupdel.c
+++ b/src/tools/sss_groupdel.c
@@ -94,7 +94,7 @@ int main(int argc, const char **argv)
goto fini;
}
- ret = sysdb_getgrnam_sync(tctx, tctx->ev, tctx->sysdb,
+ ret = sysdb_getgrnam_sync(tctx, tctx->sysdb,
tctx->octx->name, tctx->local,
tctx->octx);
if (ret != EOK) {
diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c
index 14ae6868..bd684ba0 100644
--- a/src/tools/sss_groupmod.c
+++ b/src/tools/sss_groupmod.c
@@ -123,7 +123,7 @@ int main(int argc, const char **argv)
goto fini;
}
/* check the username to be able to give sensible error message */
- ret = sysdb_getgrnam_sync(tctx, tctx->ev, tctx->sysdb,
+ ret = sysdb_getgrnam_sync(tctx, tctx->sysdb,
tctx->octx->name, tctx->local,
tctx->octx);
if (ret != EOK) {
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 59e5c604..45fd5731 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -43,13 +43,6 @@
} \
} while(0)
-#define SYNC_LOOP(ops, retval) do { \
- while (!ops->done) { \
- tevent_loop_once(ev); \
- } \
- retval = ops->error; \
-} while(0)
-
struct sync_op_res {
struct ops_ctx *data;
int error;
@@ -112,7 +105,6 @@ done:
* Modify a user
*/
struct user_mod_state {
- struct tevent_context *ev;
struct sysdb_ctx *sysdb;
struct sysdb_attrs *attrs;
@@ -591,7 +583,6 @@ int groupdel(TALLOC_CTX *mem_ctx,
* getpwnam, getgrnam and friends
*/
int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct sysdb_ctx *sysdb,
const char *name,
struct sss_domain_info *domain,
@@ -666,7 +657,6 @@ int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx,
}
int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct sysdb_ctx *sysdb,
const char *name,
struct sss_domain_info *domain,
diff --git a/src/tools/sss_sync_ops.h b/src/tools/sss_sync_ops.h
index e5ba5bee..f0faae94 100644
--- a/src/tools/sss_sync_ops.h
+++ b/src/tools/sss_sync_ops.h
@@ -93,14 +93,12 @@ int groupmod(TALLOC_CTX *mem_ctx,
struct ops_ctx *data);
int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct sysdb_ctx *sysdb,
const char *name,
struct sss_domain_info *domain,
struct ops_ctx *out);
int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct sysdb_ctx *sysdb,
const char *name,
struct sss_domain_info *domain,
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
index 620c3b2f..31932154 100644
--- a/src/tools/sss_useradd.c
+++ b/src/tools/sss_useradd.c
@@ -265,7 +265,6 @@ int main(int argc, const char **argv)
* sysdb did assign it automatically, do a lookup */
if (tctx->octx->uid == 0 || tctx->octx->gid == 0) {
ret = sysdb_getpwnam_sync(tctx,
- tctx->ev,
tctx->sysdb,
tctx->octx->name,
tctx->local,
diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c
index 55c41c24..be90fc93 100644
--- a/src/tools/sss_userdel.c
+++ b/src/tools/sss_userdel.c
@@ -232,7 +232,6 @@ int main(int argc, const char **argv)
}
ret = sysdb_getpwnam_sync(tctx,
- tctx->ev,
tctx->sysdb,
tctx->octx->name,
tctx->local,
diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c
index 43e685c5..54e3304f 100644
--- a/src/tools/sss_usermod.c
+++ b/src/tools/sss_usermod.c
@@ -141,7 +141,7 @@ int main(int argc, const char **argv)
goto fini;
}
/* check the username to be able to give sensible error message */
- ret = sysdb_getpwnam_sync(tctx, tctx->ev, tctx->sysdb,
+ ret = sysdb_getpwnam_sync(tctx, tctx->sysdb,
tctx->octx->name, tctx->local,
tctx->octx);
if (ret != EOK) {
diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c
index 021495f8..e76ffe76 100644
--- a/src/tools/tools_util.c
+++ b/src/tools/tools_util.c
@@ -44,13 +44,6 @@ static int setup_db(struct tools_ctx *ctx)
char *confdb_path;
int ret;
- /* Create the event context */
- ctx->ev = tevent_context_init(ctx);
- if (ctx->ev == NULL) {
- DEBUG(1, ("Could not create event context\n"));
- return EIO;
- }
-
confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
return ENOMEM;
@@ -211,7 +204,6 @@ int check_group_names(struct tools_ctx *tctx,
ret = EOK;
for (i=0; grouplist[i]; ++i) {
ret = sysdb_getgrnam_sync(tctx,
- tctx->ev,
tctx->sysdb,
grouplist[i],
tctx->local,
diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h
index 2996f5c1..84fc3be5 100644
--- a/src/tools/tools_util.h
+++ b/src/tools/tools_util.h
@@ -38,7 +38,6 @@
} while(0)
struct tools_ctx {
- struct tevent_context *ev;
struct confdb_ctx *confdb;
struct sysdb_ctx *sysdb;