>From a1bb4fd31808a7f734e8947b3d91c5c16359109a Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 9 Jul 2014 11:24:21 +0200 Subject: [PATCH 2/2] TOOLS: Always debug to stderr https://fedorahosted.org/sssd/ticket/2348 Programs that are supposed to only be executed on the foreground should log to stderr automatically. --- src/tests/auth-tests.c | 2 +- src/tests/cmocka/sbus_internal_tests.c | 2 +- src/tests/cmocka/test_ad_access_filter.c | 2 +- src/tests/cmocka/test_ad_common.c | 2 +- src/tests/cmocka/test_ad_gpo.c | 2 +- src/tests/cmocka/test_dp_opts.c | 2 +- src/tests/cmocka/test_dyndns.c | 2 +- src/tests/cmocka/test_fqnames.c | 2 +- src/tests/cmocka/test_ifp.c | 2 +- src/tests/cmocka/test_ipa_idmap.c | 2 +- src/tests/cmocka/test_nested_groups.c | 2 +- src/tests/cmocka/test_nss_srv.c | 2 +- src/tests/cmocka/test_responder_common.c | 2 +- src/tests/cmocka/test_sdap.c | 2 +- src/tests/cmocka/test_sss_idmap.c | 2 +- src/tests/cmocka/test_sss_sifp.c | 2 +- src/tests/cmocka/test_utils.c | 2 +- src/tests/crypto-tests.c | 2 +- src/tests/fail_over-tests.c | 2 +- src/tests/files-tests.c | 2 +- src/tests/krb5_child-test.c | 2 +- src/tests/krb5_utils-tests.c | 2 +- src/tests/refcount-tests.c | 2 +- src/tests/resolv-tests.c | 2 +- src/tests/responder_socket_access-tests.c | 2 +- src/tests/simple_access-tests.c | 2 +- src/tests/strtonum-tests.c | 2 +- src/tests/sysdb-tests.c | 2 +- src/tests/sysdb_ssh-tests.c | 2 +- src/tests/util-tests.c | 2 +- src/tools/sss_cache.c | 2 +- src/tools/sss_debuglevel.c | 2 +- src/tools/sss_groupadd.c | 2 +- src/tools/sss_groupdel.c | 2 +- src/tools/sss_groupmod.c | 2 +- src/tools/sss_groupshow.c | 2 +- src/tools/sss_seed.c | 2 +- src/tools/sss_useradd.c | 2 +- src/tools/sss_userdel.c | 2 +- src/tools/sss_usermod.c | 2 +- src/util/util.h | 8 ++++++++ 41 files changed, 48 insertions(+), 40 deletions(-) diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c index 810a02be877fb4d3adcc183a3eda9b5468e3eca0..670a4d2adc671703d872ee94cae5f6910d97cffe 100644 --- a/src/tests/auth-tests.c +++ b/src/tests/auth-tests.c @@ -317,7 +317,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/sbus_internal_tests.c b/src/tests/cmocka/sbus_internal_tests.c index 0d3e25a4e3c457a251ec0fe1c335ae8684f92fab..a79f54d266375036915c8a2ff95378a379ee4448 100644 --- a/src/tests/cmocka/sbus_internal_tests.c +++ b/src/tests/cmocka/sbus_internal_tests.c @@ -259,7 +259,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); return run_tests(tests); } diff --git a/src/tests/cmocka/test_ad_access_filter.c b/src/tests/cmocka/test_ad_access_filter.c index 3f4e44f14150a1a23eda5e7b914ddcee94203c65..7654e8498b4d5e346598964e4725f55410149585 100644 --- a/src/tests/cmocka/test_ad_access_filter.c +++ b/src/tests/cmocka/test_ad_access_filter.c @@ -349,7 +349,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/test_ad_common.c b/src/tests/cmocka/test_ad_common.c index bbd56b1b9b78cb78cb24726522822ad2f7ae9980..c4b6bd0f21827424291176abf520008d2d9488de 100644 --- a/src/tests/cmocka/test_ad_common.c +++ b/src/tests/cmocka/test_ad_common.c @@ -234,7 +234,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/test_ad_gpo.c b/src/tests/cmocka/test_ad_gpo.c index 231c3608dbde312bce468aee0ba8e2169187a68f..e6319118e3c94e3a5c9c7e06f7025f2cd4ec9037 100644 --- a/src/tests/cmocka/test_ad_gpo.c +++ b/src/tests/cmocka/test_ad_gpo.c @@ -380,7 +380,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/test_dp_opts.c b/src/tests/cmocka/test_dp_opts.c index 31dde47c75b1fada1dd03f18c59c34066c5f79a9..0f3052ab3c2add8286db6d5f065a8ca9391aae13 100644 --- a/src/tests/cmocka/test_dp_opts.c +++ b/src/tests/cmocka/test_dp_opts.c @@ -400,7 +400,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_dyndns.c b/src/tests/cmocka/test_dyndns.c index db90e661cba032dc230478dbb10cae1109c37f05..b0e8df81bc079efa8ebd8ae45603921261330c9b 100644 --- a/src/tests/cmocka/test_dyndns.c +++ b/src/tests/cmocka/test_dyndns.c @@ -422,7 +422,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_fqnames.c b/src/tests/cmocka/test_fqnames.c index c761093703b5c1a6716ef868c8d2f08ba7cb213c..a3d176af0b2fce6bb55db86756bf937fc7b8e829 100644 --- a/src/tests/cmocka/test_fqnames.c +++ b/src/tests/cmocka/test_fqnames.c @@ -537,7 +537,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_ifp.c b/src/tests/cmocka/test_ifp.c index 650a9496978854c4c1aa6b72f58e831d60ca7c10..b0f6e09900a956a51c17d1c4cf1a7772dccc3a68 100644 --- a/src/tests/cmocka/test_ifp.c +++ b/src/tests/cmocka/test_ifp.c @@ -475,7 +475,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_ipa_idmap.c b/src/tests/cmocka/test_ipa_idmap.c index 2fb2cde2f9a7f1172fb69b268d19b559ff9d2f32..8ad56298757c6b8fd2e857e1d92d0eb767b9e8c9 100644 --- a/src/tests/cmocka/test_ipa_idmap.c +++ b/src/tests/cmocka/test_ipa_idmap.c @@ -241,7 +241,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/test_nested_groups.c b/src/tests/cmocka/test_nested_groups.c index 955d05dd426af5219b7187046920de86437da4b3..0c1a53b0e6f1291b3ee55d3a4d4396e864ae228a 100644 --- a/src/tests/cmocka/test_nested_groups.c +++ b/src/tests/cmocka/test_nested_groups.c @@ -463,7 +463,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c index 24e58abe7f8bb8e4f578c2ed86a9ab7fbd6afd48..808a7a1854cb80b6ffb3f84f26144083e8599bb5 100644 --- a/src/tests/cmocka/test_nss_srv.c +++ b/src/tests/cmocka/test_nss_srv.c @@ -1666,7 +1666,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_responder_common.c b/src/tests/cmocka/test_responder_common.c index 44627ab99425943dea9a1d27daa3435e1b11ad06..24bb54ff5120b281d43ddc7d5d4443c87a22af1c 100644 --- a/src/tests/cmocka/test_responder_common.c +++ b/src/tests/cmocka/test_responder_common.c @@ -303,7 +303,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_sdap.c b/src/tests/cmocka/test_sdap.c index 33cefcc88b3a1c662751c463cc44c19526d77169..a1ecebdbda0b66c43ffd3ac1a8cf6a10481ee737 100644 --- a/src/tests/cmocka/test_sdap.c +++ b/src/tests/cmocka/test_sdap.c @@ -574,7 +574,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/cmocka/test_sss_idmap.c b/src/tests/cmocka/test_sss_idmap.c index ff933216416b61618bf764d8c2554b273706c787..ccdfa63ad6065b29187637b721b5e93548a09372 100644 --- a/src/tests/cmocka/test_sss_idmap.c +++ b/src/tests/cmocka/test_sss_idmap.c @@ -549,7 +549,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/cmocka/test_sss_sifp.c b/src/tests/cmocka/test_sss_sifp.c index 190dd76291528ab15bb25250778e4a008d1ea38b..54f2152075d860edc3a5438b4cf5cdd1a88d8f92 100644 --- a/src/tests/cmocka/test_sss_sifp.c +++ b/src/tests/cmocka/test_sss_sifp.c @@ -1923,7 +1923,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); rv = run_tests(tests); diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c index 20e21a9baee0b8e09d573f2fc723db4d7f9c6f94..e49e7eca5628a65492becbf13dfc5fb93063ff15 100644 --- a/src/tests/cmocka/test_utils.c +++ b/src/tests/cmocka/test_utils.c @@ -934,7 +934,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); /* Even though normally the tests should clean up after themselves * they might not after a failed run. Remove the old db to be sure */ diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c index 87184594e2fb7cedc234350b56aa341d9de62713..ee807c6bcc46a9adea93bcef3158daf0eec30e98 100644 --- a/src/tests/crypto-tests.c +++ b/src/tests/crypto-tests.c @@ -206,7 +206,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c index 78aaf9c10d833b04e4feacfc5bef3691abe76d2d..b21ead38229be5d55df2de10bec3dd00a8566d71 100644 --- a/src/tests/fail_over-tests.c +++ b/src/tests/fail_over-tests.c @@ -311,7 +311,7 @@ main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c index e8bd3b97d21bea2170049bbab5faedb88cf87966..09df5cbd48ae056c7d089204f15c6d3b32d98477 100644 --- a/src/tests/files-tests.c +++ b/src/tests/files-tests.c @@ -323,7 +323,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug); + DEBUG_CLI_INIT(debug); tests_set_cwd(); diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c index 4046def65d39ffdc2c97b06c2d638150f3ca2f42..63caa5f6c97f3e5c0df459b7549e681e51fcc108 100644 --- a/src/tests/krb5_child-test.c +++ b/src/tests/krb5_child-test.c @@ -443,7 +443,7 @@ main(int argc, const char *argv[]) } } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); if (opt != -1) { poptPrintUsage(pc, stderr, 0); diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c index 11fe1d749dccb5d367e3840ebc0a396b992bce2a..c59356ed040a0936394a83adedf0d51afcfdec4e 100644 --- a/src/tests/krb5_utils-tests.c +++ b/src/tests/krb5_utils-tests.c @@ -662,7 +662,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); ret = mkdir(TESTS_PATH, 0775); if (ret != EOK) { diff --git a/src/tests/refcount-tests.c b/src/tests/refcount-tests.c index 9713d4783d5ea39c1550a56c048ff1fdc6852ea8..7fb398e7aa931009c8957488bf4710cc3b33087b 100644 --- a/src/tests/refcount-tests.c +++ b/src/tests/refcount-tests.c @@ -222,7 +222,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug); + DEBUG_CLI_INIT(debug); tests_set_cwd(); diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c index abf7539db92d8a0d0b7940953d39ec57e16804ed..5b85bf6ef45485444442f029d62afc9795037137 100644 --- a/src/tests/resolv-tests.c +++ b/src/tests/resolv-tests.c @@ -967,7 +967,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug); + DEBUG_CLI_INIT(debug); if (!use_net_test) { printf("Network tests disabled. Rerun with the \"-n\" " diff --git a/src/tests/responder_socket_access-tests.c b/src/tests/responder_socket_access-tests.c index a01a5d12c24aae356a90fd537878b0a0953d89de..b1f7a4c1762664d800b046329e27bc0698ce94bf 100644 --- a/src/tests/responder_socket_access-tests.c +++ b/src/tests/responder_socket_access-tests.c @@ -163,7 +163,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); Suite *s = responder_test_suite(); diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c index 999277340e436431f14d7710c05c66823e0ebf9e..5c74eb85f80cbeee8cff456c08d9012babb9a9db 100644 --- a/src/tests/simple_access-tests.c +++ b/src/tests/simple_access-tests.c @@ -658,7 +658,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); test_dom_suite_cleanup(TESTS_PATH, TEST_CONF_FILE, LOCAL_SYSDB_FILE); diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c index 009f0049a1c23055bef8a6c11a83920db709d15d..73a07114fa16d8ba3d41e7ad8adf5a094473b524 100644 --- a/src/tests/strtonum-tests.c +++ b/src/tests/strtonum-tests.c @@ -449,7 +449,7 @@ int main(int argc, const char *argv[]) { } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 51baae1f627a2e578123424522c2963f195b76cb..d24bd4f7d4f0e8f85afa7c98da8edc0635b2e328 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -5986,7 +5986,7 @@ int main(int argc, const char *argv[]) { } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); if (!ldb_modules_path_is_set()) { fprintf(stderr, "Warning: LDB_MODULES_PATH is not set, " diff --git a/src/tests/sysdb_ssh-tests.c b/src/tests/sysdb_ssh-tests.c index ae0cb71c72827fae51c761f695277ed1ad3f15df..6a4c219b37fc71fdf35ee33b41756f77ae864d37 100644 --- a/src/tests/sysdb_ssh-tests.c +++ b/src/tests/sysdb_ssh-tests.c @@ -400,7 +400,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); if (!ldb_modules_path_is_set()) { fprintf(stderr, "Warning: LDB_MODULES_PATH is not set, " diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c index b79153e3e89b90182bfce7c504a7d6a764a0e59b..08e8b8d263c46618a0cdfb2203684305fa6dddc6 100644 --- a/src/tests/util-tests.c +++ b/src/tests/util-tests.c @@ -1083,7 +1083,7 @@ int main(int argc, const char *argv[]) } poptFreeContext(pc); - DEBUG_INIT(debug_level); + DEBUG_CLI_INIT(debug_level); tests_set_cwd(); diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index ffa4e35e28c960705733c530124927c0075242ac..7cd5852ab299466c6223fb048f35292a75f87e98 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -600,7 +600,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx) } } - DEBUG_INIT(debug); + DEBUG_CLI_INIT(debug); debug_prg_name = argv[0]; if (ret != -1) { diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c index c38591cfaf66e67c198bf83ad431df5c3e11e74b..dcacd5dc97f0f81e656737833f71abbf8f1aef29 100644 --- a/src/tools/sss_debuglevel.c +++ b/src/tools/sss_debuglevel.c @@ -88,7 +88,7 @@ int main(int argc, const char **argv) goto fini; } } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); /* get debug level */ debug_as_string = poptGetArg(pc); diff --git a/src/tools/sss_groupadd.c b/src/tools/sss_groupadd.c index 0152aeff091048aa2e0531e625456faf1fff28e1..f71d6dde722845288a67a676e4e737ecd84450a6 100644 --- a/src/tools/sss_groupadd.c +++ b/src/tools/sss_groupadd.c @@ -68,7 +68,7 @@ int main(int argc, const char **argv) BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); /* groupname is an argument, not option */ pc_groupname = poptGetArg(pc); diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c index 947bb4a4d07fb41ebe54b2a823527add9507bdff..5dcc2056dbe13896115b81d58ae34e8985dd3d38 100644 --- a/src/tools/sss_groupdel.c +++ b/src/tools/sss_groupdel.c @@ -63,7 +63,7 @@ int main(int argc, const char **argv) BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); pc_groupname = poptGetArg(pc); if (pc_groupname == NULL) { diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c index 21d78278c74fbf8855fc3e50a7902ab63a569b40..eddc7034a7e08a5cc7397f5ac2b491d8b16d4976 100644 --- a/src/tools/sss_groupmod.c +++ b/src/tools/sss_groupmod.c @@ -101,7 +101,7 @@ int main(int argc, const char **argv) BAD_POPT_PARAMS(pc, _("Specify group to modify\n"), ret, fini); } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); CHECK_ROOT(ret, debug_prg_name); diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index f7c798df635df44c9f02b52accb3da705e68971d..251e71b15d312822b4b8925b5b3063870c0147db 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -680,7 +680,7 @@ int main(int argc, const char **argv) } } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); if (ret != -1) { BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c index 32ab43b9cd5befcdf35cd170dad22ec445f667d0..0f8a76a61cb2a029015416a59d235a1c5d49deca 100644 --- a/src/tools/sss_seed.c +++ b/src/tools/sss_seed.c @@ -523,7 +523,7 @@ static int seed_init(TALLOC_CTX *mem_ctx, BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); CHECK_ROOT(ret, argv[0]); diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index cab69e46d5f47dfe498e25f4a771ba0f25ca16ca..59439401e225d752ea9a82fdb33900bf44699e18 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -99,7 +99,7 @@ int main(int argc, const char **argv) } } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); if (ret != -1) { BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c index e19143604ec54d6aa2f6abfa3cece64e18b7e709..d085dc3cabd31b2ee82b13c6cbc39c7658b071d1 100644 --- a/src/tools/sss_userdel.c +++ b/src/tools/sss_userdel.c @@ -177,7 +177,7 @@ int main(int argc, const char **argv) } } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); if (ret != -1) { BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c index 079c078e7b4cca7177f2d00ed3ec440a3013bba2..9683c6e9e7c2bf389563515162a3772ee73987ed 100644 --- a/src/tools/sss_usermod.c +++ b/src/tools/sss_usermod.c @@ -144,7 +144,7 @@ int main(int argc, const char **argv) BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini); } - DEBUG_INIT(pc_debug); + DEBUG_CLI_INIT(pc_debug); /* username is an argument without --option */ pc_username = poptGetArg(pc); diff --git a/src/util/util.h b/src/util/util.h index 6a9bc0c2e5f5dd3307a3e0708b6f755eec687ac8..b605f230aa88958e4af598e5fa7896e5a74ce9d9 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -152,6 +152,14 @@ errno_t set_debug_file_from_fd(const int fd); talloc_set_log_fn(talloc_log_fn); \ } while (0) +/* CLI tools shall debug to stderr even when SSSD was compiled with journald + * support + */ +#define DEBUG_CLI_INIT(dbg_lvl) do { \ + DEBUG_INIT(dbg_lvl); \ + debug_to_stderr = 1; \ +} while (0) + #define PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__) #define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__) -- 1.9.3