summaryrefslogtreecommitdiffstats
path: root/server/tools/tools_util.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-09-14 23:03:35 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-21 10:35:07 -0400
commit8f035b043dbd4eb631b64c4d7dcdb35272e35142 (patch)
tree3d1bbd6c615f3514d486bba4c83ce2d7b42ffd23 /server/tools/tools_util.h
parentdb329e0f8a35c23416acedaca3683392b0114c92 (diff)
downloadsssd-8f035b043dbd4eb631b64c4d7dcdb35272e35142.tar.gz
sssd-8f035b043dbd4eb631b64c4d7dcdb35272e35142.tar.xz
sssd-8f035b043dbd4eb631b64c4d7dcdb35272e35142.zip
Decouple synchronous sysdb interface from tools
Instead of working directly with async code in tools, create synchronous wrappers that could be used by tools and python bindings. Also resolves many issues with code duplication in tools and thus fixes ticket #87
Diffstat (limited to 'server/tools/tools_util.h')
-rw-r--r--server/tools/tools_util.h34
1 files changed, 11 insertions, 23 deletions
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h
index 2aca4b8be..b6509c22c 100644
--- a/server/tools/tools_util.h
+++ b/server/tools/tools_util.h
@@ -24,6 +24,7 @@
#define __TOOLS_UTIL_H__
#include "util/sssd-i18n.h"
+#include "tools/sss_sync_ops.h"
#define CHECK_ROOT(val, prg_name) do { \
val = getuid(); \
@@ -39,41 +40,26 @@ struct tools_ctx {
struct tevent_context *ev;
struct confdb_ctx *confdb;
struct sysdb_ctx *sysdb;
- struct sss_names_ctx *snctx;
-
- struct sss_domain_info *domains;
-};
-
-struct ops_ctx {
- struct tools_ctx *ctx;
- struct sss_domain_info *domain;
- char *name;
- uid_t uid;
- gid_t gid;
- char *gecos;
- char *home;
- char *shell;
- struct sysdb_attrs *attrs;
+ struct sss_names_ctx *snctx;
+ struct sss_domain_info *local;
- char **addgroups;
- char **rmgroups;
- char **groups;
- int cur;
+ struct ops_ctx *octx;
struct sysdb_handle *handle;
+ int transaction_done;
int error;
- bool done;
};
-int init_sss_tools(struct ops_ctx **_octx);
+int init_sss_tools(struct tools_ctx **_tctx);
void usage(poptContext pc, const char *error);
int set_locale(void);
-int get_domain(struct ops_ctx *octx,
- const char *fullname);
+
+int parse_name_domain(struct tools_ctx *tctx,
+ const char *fullname);
int id_in_range(uint32_t id,
struct sss_domain_info *dom);
@@ -82,4 +68,6 @@ int parse_groups(TALLOC_CTX *mem_ctx,
const char *optstr,
char ***_out);
+void tools_transaction_done(struct tevent_req *req);
+
#endif /* __TOOLS_UTIL_H__ */