From 3fc84f21bd715c4cece722231af933a1981bb6e7 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 24 Nov 2009 21:16:40 +0100 Subject: Better error message when there is no local domain configured Fixes: #235 --- server/tools/sss_groupadd.c | 6 +++++- server/tools/sss_groupdel.c | 6 +++++- server/tools/sss_groupmod.c | 6 +++++- server/tools/sss_useradd.c | 6 +++++- server/tools/sss_userdel.c | 6 +++++- server/tools/sss_usermod.c | 6 +++++- server/tools/tools_util.c | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) (limited to 'server/tools') diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c index 82d4573db..15eed100e 100644 --- a/server/tools/sss_groupadd.c +++ b/server/tools/sss_groupadd.c @@ -82,7 +82,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c index 84ea0be41..e5b043e27 100644 --- a/server/tools/sss_groupdel.c +++ b/server/tools/sss_groupdel.c @@ -77,7 +77,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c index d3a35988a..b25a018d3 100644 --- a/server/tools/sss_groupmod.c +++ b/server/tools/sss_groupmod.c @@ -107,7 +107,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c index 94de68fd9..077ac99f7 100644 --- a/server/tools/sss_useradd.c +++ b/server/tools/sss_useradd.c @@ -179,7 +179,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c index d34466e74..e84d78b17 100644 --- a/server/tools/sss_userdel.c +++ b/server/tools/sss_userdel.c @@ -98,7 +98,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c index 733f9982e..a272bc55e 100644 --- a/server/tools/sss_usermod.c +++ b/server/tools/sss_usermod.c @@ -122,7 +122,11 @@ int main(int argc, const char **argv) ret = init_sss_tools(&tctx); if (ret != EOK) { DEBUG(1, ("init_sss_tools failed (%d): %s\n", ret, strerror(ret))); - ERROR("Error initializing the tools\n"); + if (ret == ENOENT) { + ERROR("Error initializing the tools - no local domain\n"); + } else { + ERROR("Error initializing the tools\n"); + } ret = EXIT_FAILURE; goto fini; } diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c index bcb8d5c1e..b509ccb26 100644 --- a/server/tools/tools_util.c +++ b/server/tools/tools_util.c @@ -64,7 +64,7 @@ static int setup_db(struct tools_ctx *ctx) ret = confdb_get_domain(ctx->confdb, "local", &ctx->local); if (ret != EOK) { - DEBUG(1, ("Could not get 'local' domain\n")); + DEBUG(1, ("Could not get 'local' domain: [%d] [%s]\n", ret, strerror(ret))); return ret; } -- cgit