summaryrefslogtreecommitdiffstats
path: root/server/tools
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/sss_groupadd.c4
-rw-r--r--server/tools/sss_groupdel.c4
-rw-r--r--server/tools/sss_groupmod.c4
-rw-r--r--server/tools/sss_useradd.c7
-rw-r--r--server/tools/sss_userdel.c4
-rw-r--r--server/tools/sss_usermod.c4
-rw-r--r--server/tools/tools_util.c20
-rw-r--r--server/tools/tools_util.h4
8 files changed, 38 insertions, 13 deletions
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c
index 5e1aeb9b2..eb7b3d8fa 100644
--- a/server/tools/sss_groupadd.c
+++ b/server/tools/sss_groupadd.c
@@ -134,9 +134,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c
index 8e07febf5..315871073 100644
--- a/server/tools/sss_groupdel.c
+++ b/server/tools/sss_groupdel.c
@@ -127,9 +127,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c
index e2c59cba1..d6c191524 100644
--- a/server/tools/sss_groupmod.c
+++ b/server/tools/sss_groupmod.c
@@ -254,9 +254,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c
index a01cd7f82..84f38fa6d 100644
--- a/server/tools/sss_useradd.c
+++ b/server/tools/sss_useradd.c
@@ -31,6 +31,7 @@
#include "util/util.h"
#include "db/sysdb.h"
#include "tools/tools_util.h"
+#include "util/sssd-i18n.h"
/* Define default command strings if not redefined by user */
#ifndef USERADD
@@ -335,9 +336,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
@@ -480,7 +481,7 @@ int main(int argc, const char **argv)
ret = user_ctx->error;
switch (ret) {
case EEXIST:
- DEBUG(0, ("The user %s already exists\n", user_ctx->username));
+ DEBUG(0, (_("The user %s already exists\n"), user_ctx->username));
break;
default:
diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c
index 713c93831..e374b14bd 100644
--- a/server/tools/sss_userdel.c
+++ b/server/tools/sss_userdel.c
@@ -126,9 +126,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c
index d19fe9d8a..a5eadce24 100644
--- a/server/tools/sss_usermod.c
+++ b/server/tools/sss_usermod.c
@@ -322,9 +322,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c
index 0f093cb8f..15665d36a 100644
--- a/server/tools/tools_util.c
+++ b/server/tools/tools_util.c
@@ -228,3 +228,23 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, char ***_out)
return EOK;
}
+int init_sss_tools(struct tools_ctx **ctx)
+{
+ int ret;
+ /* Set up LOCALE */
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ /* Connect to the database */
+ ret = setup_db(ctx);
+ if (ret != EOK) {
+ DEBUG(0, ("Could not set up database\n"));
+ ret = EXIT_FAILURE;
+ goto fini;
+ }
+
+ ret = EOK;
+fini:
+ return ret;
+}
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h
index e055fe23b..7c66c119d 100644
--- a/server/tools/tools_util.h
+++ b/server/tools/tools_util.h
@@ -1,6 +1,8 @@
#ifndef __TOOLS_UTIL_H__
#define __TOOLS_UTIL_H__
+#include "util/sssd-i18n.h"
+
#define UID_NOT_SET 0
#define GID_NOT_SET 0
@@ -36,6 +38,8 @@ struct tools_ctx {
struct sss_domain_info *domains;
};
+int init_sss_tools(struct tools_ctx **ctx);
+
int setup_db(struct tools_ctx **ctx);
void usage(poptContext pc, const char *error);