summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/monitor/monitor.c2
-rw-r--r--src/providers/data_provider_be.c3
-rw-r--r--src/providers/krb5/krb5_child.c2
-rw-r--r--src/providers/ldap/ldap_child.c2
-rw-r--r--src/providers/proxy/proxy_child.c2
-rw-r--r--src/responder/autofs/autofssrv.c2
-rw-r--r--src/responder/nss/nsssrv.c2
-rw-r--r--src/responder/pac/pacsrv.c2
-rw-r--r--src/responder/pam/pamsrv.c2
-rw-r--r--src/responder/ssh/sshsrv.c2
-rw-r--r--src/responder/sudo/sudosrv.c2
-rw-r--r--src/sss_client/ssh/sss_ssh_authorizedkeys.c2
-rw-r--r--src/sss_client/ssh/sss_ssh_knownhostsproxy.c2
-rw-r--r--src/tests/auth-tests.c2
-rw-r--r--src/tests/crypto-tests.c2
-rw-r--r--src/tests/fail_over-tests.c2
-rw-r--r--src/tests/files-tests.c2
-rw-r--r--src/tests/krb5_child-test.c2
-rw-r--r--src/tests/krb5_utils-tests.c2
-rw-r--r--src/tests/refcount-tests.c2
-rw-r--r--src/tests/resolv-tests.c2
-rw-r--r--src/tests/responder_socket_access-tests.c2
-rw-r--r--src/tests/simple_access-tests.c2
-rw-r--r--src/tests/strtonum-tests.c2
-rw-r--r--src/tests/sysdb-tests.c2
-rw-r--r--src/tests/sysdb_ssh-tests.c2
-rw-r--r--src/tests/util-tests.c2
-rw-r--r--src/tools/sss_cache.c2
-rw-r--r--src/tools/sss_debuglevel.c2
-rw-r--r--src/tools/sss_groupadd.c2
-rw-r--r--src/tools/sss_groupdel.c2
-rw-r--r--src/tools/sss_groupmod.c2
-rw-r--r--src/tools/sss_groupshow.c2
-rw-r--r--src/tools/sss_seed.c2
-rw-r--r--src/tools/sss_useradd.c2
-rw-r--r--src/tools/sss_userdel.c2
-rw-r--r--src/tools/sss_usermod.c2
-rw-r--r--src/util/debug.c5
-rw-r--r--src/util/util.h15
39 files changed, 52 insertions, 43 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index a5653999..af2189c7 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2497,7 +2497,7 @@ int main(int argc, const char *argv[])
}
}
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
if (opt_version) {
puts(VERSION""DISTRO_VERSION""PRERELEASE_VERSION);
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index 4e4bdab2..0ac83f43 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -2388,8 +2388,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
-
+ DEBUG_INIT(debug_level);
/* set up things like debug , signals, daemonization, etc... */
debug_log_file = talloc_asprintf(NULL, "sssd_%s", be_domain);
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 3e64a865..e7776248 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -2078,7 +2078,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
debug_prg_name = talloc_asprintf(NULL, "[sssd[krb5_child[%d]]]", getpid());
if (!debug_prg_name) {
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index f35d9467..9d82e7cf 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -458,7 +458,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
debug_prg_name = talloc_asprintf(NULL, "[sssd[ldap_child[%d]]]", getpid());
if (!debug_prg_name) {
diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index 8aa1d762..c575948a 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -510,7 +510,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug , signals, daemonization, etc... */
debug_log_file = talloc_asprintf(NULL, "proxy_child_%s", domain);
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c
index dcb188fd..86a816a3 100644
--- a/src/responder/autofs/autofssrv.c
+++ b/src/responder/autofs/autofssrv.c
@@ -198,7 +198,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_autofs";
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 1156c45f..e01bd1a4 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -472,7 +472,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_nss";
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index 348fc6f4..036dd6a5 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -235,7 +235,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_pac";
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index c94596c4..c608f581 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -236,7 +236,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_pam";
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index fe01f81f..32c0f308 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -186,7 +186,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_ssh";
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index b4f8f887..cb89e1f7 100644
--- a/src/responder/sudo/sudosrv.c
+++ b/src/responder/sudo/sudosrv.c
@@ -176,7 +176,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_sudo";
diff --git a/src/sss_client/ssh/sss_ssh_authorizedkeys.c b/src/sss_client/ssh/sss_ssh_authorizedkeys.c
index 902b4a07..11deff9a 100644
--- a/src/sss_client/ssh/sss_ssh_authorizedkeys.c
+++ b/src/sss_client/ssh/sss_ssh_authorizedkeys.c
@@ -73,7 +73,7 @@ int main(int argc, const char **argv)
while ((ret = poptGetNextOpt(pc)) > 0)
;
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_INIT(pc_debug);
if (ret != -1) {
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
diff --git a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
index 76356bdc..600895d1 100644
--- a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
+++ b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
@@ -228,7 +228,7 @@ int main(int argc, const char **argv)
while ((ret = poptGetNextOpt(pc)) > 0)
;
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_INIT(pc_debug);
if (ret != -1) {
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index 4d25e2ef..ff8b9e1b 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c
index 0492a384..8932d8f5 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c
index 3a7c4ae4..93dda3a7 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index cb20e1aa..56c9ab9b 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -322,7 +322,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c
index d55eec07..34d025b7 100644
--- a/src/tests/krb5_child-test.c
+++ b/src/tests/krb5_child-test.c
@@ -477,7 +477,7 @@ main(int argc, const char *argv[])
}
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 fe5d8423..77dc27ca 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -791,7 +791,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_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 18f55532..9a7e5b94 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c
index ad89aaf6..c61d6f8c 100644
--- a/src/tests/resolv-tests.c
+++ b/src/tests/resolv-tests.c
@@ -856,7 +856,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
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 734bf1cb..a01a5d12 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_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 c61814eb..486f87d9 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -196,7 +196,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c
index e7d70364..009f0049 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);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index d9afe7b8..3a07a649 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -4099,7 +4099,7 @@ int main(int argc, const char *argv[]) {
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/sysdb_ssh-tests.c b/src/tests/sysdb_ssh-tests.c
index f914993c..f44c2f94 100644
--- a/src/tests/sysdb_ssh-tests.c
+++ b/src/tests/sysdb_ssh-tests.c
@@ -402,7 +402,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index 59c80ca6..80c03c73 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -713,7 +713,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+ DEBUG_INIT(debug_level);
tests_set_cwd();
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 73d99651..9b91f982 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -414,7 +414,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx)
ret, fini);
}
- debug_level = debug_convert_old_level(debug);
+ DEBUG_INIT(debug);
debug_prg_name = argv[0];
CHECK_ROOT(ret, debug_prg_name);
diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c
index 72701386..e955ec38 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_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 2a01f392..5667e9aa 100644
--- a/src/tools/sss_groupadd.c
+++ b/src/tools/sss_groupadd.c
@@ -67,7 +67,7 @@ int main(int argc, const char **argv)
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 70030cab..57c3e700 100644
--- a/src/tools/sss_groupdel.c
+++ b/src/tools/sss_groupdel.c
@@ -61,7 +61,7 @@ int main(int argc, const char **argv)
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 c210bad7..1d80c592 100644
--- a/src/tools/sss_groupmod.c
+++ b/src/tools/sss_groupmod.c
@@ -100,7 +100,7 @@ int main(int argc, const char **argv)
BAD_POPT_PARAMS(pc, _("Specify group to modify\n"), ret, fini);
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_INIT(pc_debug);
CHECK_ROOT(ret, debug_prg_name);
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index 2ba495c1..7ba1db13 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -675,7 +675,7 @@ int main(int argc, const char **argv)
}
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 18d0b9d0..cd1b2638 100644
--- a/src/tools/sss_seed.c
+++ b/src/tools/sss_seed.c
@@ -521,7 +521,7 @@ static int seed_init(TALLOC_CTX *mem_ctx,
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_INIT(pc_debug);
CHECK_ROOT(ret, argv[0]);
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
index 1bf174c5..ef594aed 100644
--- a/src/tools/sss_useradd.c
+++ b/src/tools/sss_useradd.c
@@ -98,7 +98,7 @@ int main(int argc, const char **argv)
}
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 0d1c63e4..5d250f6c 100644
--- a/src/tools/sss_userdel.c
+++ b/src/tools/sss_userdel.c
@@ -173,7 +173,7 @@ int main(int argc, const char **argv)
}
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_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 a45005ca..f6730368 100644
--- a/src/tools/sss_usermod.c
+++ b/src/tools/sss_usermod.c
@@ -111,7 +111,7 @@ int main(int argc, const char **argv)
BAD_POPT_PARAMS(pc, poptStrerror(ret), ret, fini);
}
- debug_level = debug_convert_old_level(pc_debug);
+ DEBUG_INIT(pc_debug);
/* username is an argument without --option */
pc_username = poptGetArg(pc);
diff --git a/src/util/debug.c b/src/util/debug.c
index e57656d7..cb90d65a 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -256,3 +256,8 @@ int rotate_debug_files(void)
return open_debug_file();
}
+
+void talloc_log_fn(const char *message)
+{
+ DEBUG(SSSDBG_FATAL_FAILURE, (message));
+}
diff --git a/src/util/util.h b/src/util/util.h
index a96f519a..df57a3de 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -194,11 +194,15 @@ errno_t set_debug_file_from_fd(const int fd);
*/
#define DEBUG_IS_SET(level) (debug_level & (level))
-#define CONVERT_AND_SET_DEBUG_LEVEL(new_value) debug_level = ( \
- ((new_value) != SSSDBG_INVALID) \
- ? debug_convert_old_level(new_value) \
- : SSSDBG_UNRESOLVED /* Debug level should be loaded from config file. */ \
-);
+#define DEBUG_INIT(dbg_lvl) do { \
+ if (dbg_lvl != SSSDBG_INVALID) { \
+ debug_level = debug_convert_old_level(dbg_lvl); \
+ } else { \
+ debug_level = SSSDBG_UNRESOLVED; \
+ } \
+\
+ talloc_set_log_fn(talloc_log_fn); \
+} while (0)
#define PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__)
#define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__)
@@ -341,6 +345,7 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
int open_debug_file_ex(const char *filename, FILE **filep);
int open_debug_file(void);
int rotate_debug_files(void);
+void talloc_log_fn(const char *msg);
/* From sss_log.c */
#define SSS_LOG_EMERG 0 /* system is unusable */