summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/monitor/monitor.c10
-rw-r--r--src/providers/data_provider_be.c5
-rw-r--r--src/providers/krb5/krb5_child.c4
-rw-r--r--src/providers/ldap/ldap_child.c5
-rw-r--r--src/providers/proxy/proxy_child.c5
-rw-r--r--src/responder/nss/nsssrv.c5
-rw-r--r--src/responder/pam/pamsrv.c5
-rw-r--r--src/tests/auth-tests.c5
-rw-r--r--src/tests/crypto-tests.c5
-rw-r--r--src/tests/debug-tests.c10
-rw-r--r--src/tests/fail_over-tests.c6
-rw-r--r--src/tests/files-tests.c6
-rw-r--r--src/tests/krb5_utils-tests.c5
-rw-r--r--src/tests/refcount-tests.c6
-rw-r--r--src/tests/resolv-tests.c6
-rw-r--r--src/tests/simple_access-tests.c5
-rw-r--r--src/tests/strtonum-tests.c5
-rw-r--r--src/tests/sysdb-tests.c5
-rw-r--r--src/tests/util-tests.c5
-rw-r--r--src/tools/sss_cache.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_useradd.c2
-rw-r--r--src/tools/sss_userdel.c2
-rw-r--r--src/tools/sss_usermod.c2
-rw-r--r--src/util/debug.c9
-rw-r--r--src/util/server.c2
-rw-r--r--src/util/util.h13
30 files changed, 99 insertions, 49 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 20696246..45744758 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -943,7 +943,7 @@ static int get_service_config(struct mt_ctx *ctx, const char *name,
}
if (!svc->command) {
- if (cmdline_debug_level == SSS_UNRESOLVED_DEBUG_LEVEL) {
+ if (cmdline_debug_level == SSSDBG_UNRESOLVED) {
svc->command = talloc_asprintf(svc, "%s/sssd_%s %s%s",
SSSD_LIBEXEC_PATH,
svc->name,
@@ -1089,7 +1089,7 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
/* if there are no custom commands, build a default one */
if (!svc->command) {
- if (cmdline_debug_level == SSS_UNRESOLVED_DEBUG_LEVEL) {
+ if (cmdline_debug_level == SSSDBG_UNRESOLVED) {
svc->command = talloc_asprintf(svc,
"%s/sssd_be --domain %s%s%s",
SSSD_LIBEXEC_PATH,
@@ -2321,6 +2321,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -2331,7 +2334,8 @@ int main(int argc, const char *argv[])
return 1;
}
}
- debug_level = debug_convert_old_level(debug_level);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
/* If the level was passed at the command-line, we want
* to save it and pass it to the children later.
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index 7df82f44..da80f130 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -1197,6 +1197,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -1216,7 +1219,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
/* set up things like debug , signals, daemonization, etc... */
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 48442de9..fc678efa 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -1559,6 +1559,8 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
@@ -1573,7 +1575,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
DEBUG(7, ("krb5_child started.\n"));
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 8a1dc490..368c2012 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -365,6 +365,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -378,7 +381,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
DEBUG(7, ("ldap_child started.\n"));
diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index d19cc74c..8aa1d762 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -480,6 +480,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -507,7 +510,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(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/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 7f60b732..b3e2c696 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -340,6 +340,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -353,7 +356,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_nss";
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index 2308288d..2933c79f 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -196,6 +196,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -209,7 +212,7 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_pam";
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c
index aae2d008..96bae98e 100644
--- a/src/tests/auth-tests.c
+++ b/src/tests/auth-tests.c
@@ -308,6 +308,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -320,7 +323,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c
index 0f6f2fe0..ba584668 100644
--- a/src/tests/crypto-tests.c
+++ b/src/tests/crypto-tests.c
@@ -122,6 +122,8 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
@@ -135,7 +137,8 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
+
tests_set_cwd();
Suite *s = crypto_suite();
diff --git a/src/tests/debug-tests.c b/src/tests/debug-tests.c
index 99f92a0c..2708cec1 100644
--- a/src/tests/debug-tests.c
+++ b/src/tests/debug-tests.c
@@ -49,11 +49,6 @@ START_TEST(test_debug_convert_old_level_old_format)
SSSDBG_TRACE_ALL
};
- fail_unless(
- debug_convert_old_level(SSS_UNRESOLVED_DEBUG_LEVEL) == SSSDBG_UNRESOLVED,
- "Invalid conversion of SSS_UNRESOLVED_DEBUG_LEVEL"
- );
-
for (old_level = 0; old_level <= 9; old_level++) {
expected_level |= levels[old_level];
@@ -68,7 +63,7 @@ END_TEST
START_TEST(test_debug_convert_old_level_new_format)
{
fail_unless(
- debug_convert_old_level(SSSDBG_UNRESOLVED) == SSSDBG_UNRESOLVED,
+ debug_convert_old_level(SSSDBG_UNRESOLVED) == SSSDBG_FATAL_FAILURE,
"Invalid conversion of SSSDBG_UNRESOLVED"
);
fail_unless(
@@ -120,7 +115,6 @@ END_TEST
START_TEST(test_debug_get_level_old_format)
{
- fail_unless(debug_get_level(SSS_UNRESOLVED_DEBUG_LEVEL) == SSSDBG_UNRESOLVED, "Invalid conversion of -1");
fail_unless(debug_get_level(0) == SSSDBG_FATAL_FAILURE, "Invalid conversion of 0");
fail_unless(debug_get_level(1) == SSSDBG_CRIT_FAILURE, "Invalid conversion of 1");
fail_unless(debug_get_level(2) == SSSDBG_OP_FAILURE, "Invalid conversion of 2");
@@ -137,7 +131,7 @@ END_TEST
START_TEST(test_debug_get_level_new_format)
{
fail_unless(
- debug_get_level(SSSDBG_UNRESOLVED) == SSSDBG_UNRESOLVED,
+ debug_get_level(SSSDBG_UNRESOLVED) == SSSDBG_FATAL_FAILURE,
"Invalid conversion of SSSDBG_UNRESOLVED"
);
fail_unless(
diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c
index 439e5cf2..64ed1978 100644
--- a/src/tests/fail_over-tests.c
+++ b/src/tests/fail_over-tests.c
@@ -292,6 +292,9 @@ main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -307,7 +310,8 @@ main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index 15d34c8e..cb20e1aa 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -310,6 +310,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, (const char **) argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
fprintf(stderr, "\nInvalid option %s: %s\n\n",
@@ -318,7 +321,8 @@ int main(int argc, const char *argv[])
return 1;
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
index 65e43193..4392abd7 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -642,6 +642,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -654,7 +657,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(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 99eedd9d..18f55532 100644
--- a/src/tests/refcount-tests.c
+++ b/src/tests/refcount-tests.c
@@ -207,6 +207,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -218,7 +221,8 @@ int main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c
index 3768fc97..b9a33ca7 100644
--- a/src/tests/resolv-tests.c
+++ b/src/tests/resolv-tests.c
@@ -770,6 +770,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -790,7 +793,8 @@ int main(int argc, const char *argv[])
}
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug);
+
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
if (!use_net_test) {
printf("Network tests disabled. Rerun with the \"-n\" "
diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c
index 6ae2356b..9cd73d84 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -150,6 +150,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -162,7 +165,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
Suite *s = access_simple_suite();
SRunner *sr = srunner_create(s);
diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c
index 8e86c11f..441b262c 100644
--- a/src/tests/strtonum-tests.c
+++ b/src/tests/strtonum-tests.c
@@ -434,6 +434,9 @@ int main(int argc, const char *argv[]) {
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -446,7 +449,7 @@ int main(int argc, const char *argv[]) {
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 87b06ee4..c2765828 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3108,6 +3108,9 @@ int main(int argc, const char *argv[]) {
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -3120,7 +3123,7 @@ int main(int argc, const char *argv[]) {
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index b347aa7e..52d30277 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -343,6 +343,9 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
+ /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ debug_level = SSSDBG_INVALID;
+
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -355,7 +358,7 @@ int main(int argc, const char *argv[])
}
poptFreeContext(pc);
- debug_level = debug_convert_old_level(debug_level);
+ CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
tests_set_cwd();
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 7f45ebb8..e8b1926b 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -250,7 +250,7 @@ errno_t init_context(int argc, const char *argv[], struct cache_tool_ctx **tctx)
char *group = NULL;
char *netgroup = NULL;
char *domain = NULL;
- int debug = 0;
+ int debug = SSSDBG_DEFAULT;
errno_t ret = EOK;
poptContext pc = NULL;
diff --git a/src/tools/sss_groupadd.c b/src/tools/sss_groupadd.c
index 90b1d08f..1f974cd0 100644
--- a/src/tools/sss_groupadd.c
+++ b/src/tools/sss_groupadd.c
@@ -34,7 +34,7 @@
int main(int argc, const char **argv)
{
gid_t pc_gid = 0;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
struct poptOption long_options[] = {
POPT_AUTOHELP
{ "debug",'\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug,
diff --git a/src/tools/sss_groupdel.c b/src/tools/sss_groupdel.c
index 49c5ad34..09f73504 100644
--- a/src/tools/sss_groupdel.c
+++ b/src/tools/sss_groupdel.c
@@ -32,7 +32,7 @@
int main(int argc, const char **argv)
{
int ret = EXIT_SUCCESS;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
const char *pc_groupname = NULL;
struct tools_ctx *tctx = NULL;
diff --git a/src/tools/sss_groupmod.c b/src/tools/sss_groupmod.c
index bea57f87..47134aed 100644
--- a/src/tools/sss_groupmod.c
+++ b/src/tools/sss_groupmod.c
@@ -35,7 +35,7 @@
int main(int argc, const char **argv)
{
gid_t pc_gid = 0;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
struct poptOption long_options[] = {
POPT_AUTOHELP
{ "debug", '\0', POPT_ARG_INT | POPT_ARGFLAG_DOC_HIDDEN, &pc_debug,
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index 40af95cc..764e3241 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -601,7 +601,7 @@ static void print_recursive(struct group_info **group_members, int level)
int main(int argc, const char **argv)
{
int ret = EXIT_SUCCESS;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
bool pc_recursive = false;
const char *pc_groupname = NULL;
struct tools_ctx *tctx = NULL;
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c
index 3b035163..747ebaf5 100644
--- a/src/tools/sss_useradd.c
+++ b/src/tools/sss_useradd.c
@@ -38,7 +38,7 @@ int main(int argc, const char **argv)
const char *pc_gecos = NULL;
const char *pc_home = NULL;
char *pc_shell = NULL;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
int pc_create_home = 0;
const char *pc_username = NULL;
const char *pc_skeldir = NULL;
diff --git a/src/tools/sss_userdel.c b/src/tools/sss_userdel.c
index 1de40690..6d5e8295 100644
--- a/src/tools/sss_userdel.c
+++ b/src/tools/sss_userdel.c
@@ -120,7 +120,7 @@ int main(int argc, const char **argv)
struct tools_ctx *tctx = NULL;
const char *pc_username = NULL;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
int pc_remove = 0;
int pc_force = 0;
int pc_kick = 0;
diff --git a/src/tools/sss_usermod.c b/src/tools/sss_usermod.c
index 50fb0a0e..dfcde9e5 100644
--- a/src/tools/sss_usermod.c
+++ b/src/tools/sss_usermod.c
@@ -40,7 +40,7 @@ int main(int argc, const char **argv)
char *pc_gecos = NULL;
char *pc_home = NULL;
char *pc_shell = NULL;
- int pc_debug = 0;
+ int pc_debug = SSSDBG_DEFAULT;
const char *pc_selinux_user = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
diff --git a/src/util/debug.c b/src/util/debug.c
index e7ae8386..3a1b7ca2 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -35,7 +35,6 @@ const char *debug_prg_name = "sssd";
int debug_level = SSSDBG_UNRESOLVED;
int debug_timestamps = SSSDBG_TIMESTAMP_UNRESOLVED;
-
int debug_to_file = 0;
const char *debug_log_file = "sssd";
FILE *debug_file = NULL;
@@ -63,12 +62,9 @@ int debug_convert_old_level(int old_level)
if ((old_level != 0) && !(old_level & 0x000F))
return old_level;
- if( old_level == SSS_UNRESOLVED_DEBUG_LEVEL )
- return SSSDBG_UNRESOLVED;
-
int new_level = SSSDBG_FATAL_FAILURE;
- if (old_level == 0)
+ if (old_level <= 0)
return new_level;
if (old_level >= 1)
@@ -118,9 +114,6 @@ int debug_get_level(int old_level)
if ((old_level != 0) && !(old_level & 0x000F))
return old_level;
- if( old_level == SSS_UNRESOLVED_DEBUG_LEVEL )
- return SSSDBG_UNRESOLVED;
-
if ((old_level > 9) || (old_level < 0))
return SSSDBG_FATAL_FAILURE;
diff --git a/src/util/server.c b/src/util/server.c
index 38b1baca..42fd9360 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -459,7 +459,7 @@ int server_setup(const char *name, int flags,
return ret;
}
- if (debug_level == SSS_UNRESOLVED_DEBUG_LEVEL) {
+ if (debug_level == SSSDBG_UNRESOLVED) {
/* set debug level if any in conf_entry */
ret = confdb_get_int(ctx->confdb_ctx, ctx, conf_entry,
CONFDB_SERVICE_DEBUG_LEVEL,
diff --git a/src/util/util.h b/src/util/util.h
index 22b0937d..c37cab8a 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -61,8 +61,6 @@ int debug_get_level(int old_level);
int debug_convert_old_level(int old_level);
errno_t set_debug_file_from_fd(const int fd);
-#define SSS_UNRESOLVED_DEBUG_LEVEL SSSDBG_UNRESOLVED
-
#define SSSDBG_FATAL_FAILURE 0x0010 /* level 0 */
#define SSSDBG_CRIT_FAILURE 0x0020 /* level 1 */
#define SSSDBG_OP_FAILURE 0x0040 /* level 2 */
@@ -74,7 +72,8 @@ errno_t set_debug_file_from_fd(const int fd);
#define SSSDBG_TRACE_INTERNAL 0x2000 /* level 8 */
#define SSSDBG_TRACE_ALL 0x4000 /* level 9 */
-#define SSSDBG_UNRESOLVED -1
+#define SSSDBG_INVALID -1
+#define SSSDBG_UNRESOLVED 0
#define SSSDBG_MASK_ALL 0xFFF0 /* enable all debug levels */
#define SSSDBG_DEFAULT SSSDBG_FATAL_FAILURE
@@ -153,7 +152,13 @@ errno_t set_debug_file_from_fd(const int fd);
\param level the debug level, please use one of the SSSDBG*_ macros
*/
-#define DEBUG_IS_SET(level) ((debug_level > 0) && (debug_level & (level)))
+#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 PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__)
#define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__)