summaryrefslogtreecommitdiffstats
path: root/server/tools/tools_util.h
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-08-28 18:20:44 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-21 10:35:07 -0400
commitdb329e0f8a35c23416acedaca3683392b0114c92 (patch)
treeb9b393efe9a7af5190edb5c71d80b9fb24e45e89 /server/tools/tools_util.h
parent31e6cb0a887f8c19b8558aa5fe7363201848e815 (diff)
downloadsssd-db329e0f8a35c23416acedaca3683392b0114c92.tar.gz
sssd-db329e0f8a35c23416acedaca3683392b0114c92.tar.xz
sssd-db329e0f8a35c23416acedaca3683392b0114c92.zip
Refactor tools code
Move parameter parsing in tools before attempting to do anything that might fail - so that we have debug_level set correctly for potential error messages. That allows printing the --help and --usage messages without being root. Fix code duplicates in tools and refactor its code a little to lay ground for decoupling the synchronous interfaces. Remove some legacy tools leftovers, re-add sensible error message on removing nonexistent users/groups which was removed by accident. Fixes: Trac ticket #75 Fix typo in groupdel: fixes ticket #136
Diffstat (limited to 'server/tools/tools_util.h')
-rw-r--r--server/tools/tools_util.h32
1 files changed, 1 insertions, 31 deletions
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h
index 8cbbc7ed7..2aca4b8be 100644
--- a/server/tools/tools_util.h
+++ b/server/tools/tools_util.h
@@ -25,25 +25,6 @@
#include "util/sssd-i18n.h"
-#define UID_NOT_SET 0
-#define GID_NOT_SET 0
-
-#define APPEND_PARAM(str, param, val) do { \
- if (val) { \
- str = talloc_asprintf_append(str, param, val); \
- if (str == NULL) { \
- return ENOMEM; \
- } \
- } \
-} while(0)
-
-#define APPEND_STRING(str, val) do { \
- str = talloc_asprintf_append(str, "%s ", val); \
- if (str == NULL) { \
- return ENOMEM; \
- } \
-} while(0)
-
#define CHECK_ROOT(val, prg_name) do { \
val = getuid(); \
if (val != 0) { \
@@ -54,14 +35,6 @@
} \
} while(0)
-enum id_domain {
- ID_IN_LOCAL = 0,
- ID_IN_LEGACY_LOCAL,
- ID_IN_OTHER,
- ID_OUTSIDE,
- ID_ERROR
-};
-
struct tools_ctx {
struct tevent_context *ev;
struct confdb_ctx *confdb;
@@ -73,7 +46,6 @@ struct tools_ctx {
struct ops_ctx {
struct tools_ctx *ctx;
- struct tevent_context *ev;
struct sss_domain_info *domain;
char *name;
@@ -94,9 +66,7 @@ struct ops_ctx {
bool done;
};
-int init_sss_tools(struct tools_ctx **_ctx);
-
-int setup_db(struct tools_ctx **ctx);
+int init_sss_tools(struct ops_ctx **_octx);
void usage(poptContext pc, const char *error);