diff options
41 files changed, 48 insertions, 40 deletions
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c index 810a02be8..670a4d2ad 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 0d3e25a4e..a79f54d26 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 3f4e44f14..7654e8498 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 bbd56b1b9..c4b6bd0f2 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 231c3608d..e6319118e 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 31dde47c7..0f3052ab3 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 db90e661c..b0e8df81b 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 c76109370..a3d176af0 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 650a94969..b0f6e0990 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 2fb2cde2f..8ad562987 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 955d05dd4..0c1a53b0e 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 24e58abe7..808a7a185 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 44627ab99..24bb54ff5 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 f61c38c5f..7c7eb3436 100644 --- a/src/tests/cmocka/test_sdap.c +++ b/src/tests/cmocka/test_sdap.c @@ -575,7 +575,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 ff9332164..ccdfa63ad 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 190dd7629..54f215207 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 20e21a9ba..e49e7eca5 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 87184594e..ee807c6bc 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 78aaf9c10..b21ead382 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 e8bd3b97d..09df5cbd4 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 4046def65..63caa5f6c 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 11fe1d749..c59356ed0 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 9713d4783..7fb398e7a 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 abf7539db..5b85bf6ef 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 a01a5d12c..b1f7a4c17 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 999277340..5c74eb85f 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 009f0049a..73a07114f 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 51baae1f6..d24bd4f7d 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 ae0cb71c7..6a4c219b3 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 b79153e3e..08e8b8d26 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 ffa4e35e2..7cd5852ab 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 c38591cfa..dcacd5dc9 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 0152aeff0..f71d6dde7 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 947bb4a4d..5dcc2056d 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 21d78278c..eddc7034a 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 f7c798df6..251e71b15 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 32ab43b9c..0f8a76a61 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 cab69e46d..59439401e 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 e19143604..d085dc3ca 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 079c078e7..9683c6e9e 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 6a9bc0c2e..b605f230a 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__) |