summaryrefslogtreecommitdiff
path: root/server/tools
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-06-15 10:54:09 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-06-17 07:23:24 -0400
commitad4e495fa434f72de37846704cb08bacac3c52da (patch)
treee2327aca6935c1e3bc726b880a70a4e666bab667 /server/tools
parent7d2f248b39aa78eaa7708ce64ad146d5a8bb934c (diff)
downloadsssd-ad4e495fa434f72de37846704cb08bacac3c52da.tar.gz
sssd-ad4e495fa434f72de37846704cb08bacac3c52da.tar.bz2
sssd-ad4e495fa434f72de37846704cb08bacac3c52da.zip
Create gettext framework for SSSD daemon
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 5e1aeb9b..eb7b3d8f 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 8e07febf..31587107 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 e2c59cba..d6c19152 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 a01cd7f8..84f38fa6 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 713c9383..e374b14b 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 d19fe9d8..a5eadce2 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 0f093cb8..15665d36 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 e055fe23..7c66c119 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);