diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2014-02-12 10:12:59 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-02-12 22:31:02 +0100 |
commit | 83bf46f4066e3d5e838a32357c201de9bd6ecdfd (patch) | |
tree | 65f491f7661bd533398625e015f2b5e5bff3badf /src/tools/sss_useradd.c | |
parent | 45a1d9d597df977354428440aeff11c6a0a947fe (diff) | |
download | sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.gz sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.tar.xz sssd-83bf46f4066e3d5e838a32357c201de9bd6ecdfd.zip |
Update DEBUG* invocations to use new levels
Use a script to update DEBUG* macro invocations, which use literal
numbers for levels, to use bitmask macros instead:
grep -rl --include '*.[hc]' DEBUG . |
while read f; do
mv "$f"{,.orig}
perl -e 'use strict;
use File::Slurp;
my @map=qw"
SSSDBG_FATAL_FAILURE
SSSDBG_CRIT_FAILURE
SSSDBG_OP_FAILURE
SSSDBG_MINOR_FAILURE
SSSDBG_CONF_SETTINGS
SSSDBG_FUNC_DATA
SSSDBG_TRACE_FUNC
SSSDBG_TRACE_LIBS
SSSDBG_TRACE_INTERNAL
SSSDBG_TRACE_ALL
";
my $text=read_file(\*STDIN);
my $repl;
$text=~s/
^
(
.*
\b
(DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM)
\s*
\(\s*
)(
[0-9]
)(
\s*,
)
(
\s*
)
(
.*
)
$
/
$repl = $1.$map[$3].$4.$5.$6,
length($repl) <= 80
? $repl
: $1.$map[$3].$4."\n".(" " x length($1)).$6
/xmge;
print $text;
' < "$f.orig" > "$f"
rm "$f.orig"
done
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'src/tools/sss_useradd.c')
-rw-r--r-- | src/tools/sss_useradd.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/tools/sss_useradd.c b/src/tools/sss_useradd.c index 764c2a42e..cab69e46d 100644 --- a/src/tools/sss_useradd.c +++ b/src/tools/sss_useradd.c @@ -69,7 +69,8 @@ int main(int argc, const char **argv) ret = set_locale(); if (ret != EOK) { - DEBUG(1, "set_locale failed (%d): %s\n", ret, strerror(ret)); + DEBUG(SSSDBG_CRIT_FAILURE, + "set_locale failed (%d): %s\n", ret, strerror(ret)); ERROR("Error setting the locale\n"); ret = EXIT_FAILURE; goto fini; @@ -114,7 +115,8 @@ 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)); + DEBUG(SSSDBG_CRIT_FAILURE, + "init_sss_tools failed (%d): %s\n", ret, strerror(ret)); if (ret == ENOENT) { ERROR("Error initializing the tools - no local domain\n"); } else { @@ -135,7 +137,8 @@ int main(int argc, const char **argv) if (groups) { ret = parse_groups(tctx, groups, &tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse groups to add the user to\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse groups to add the user to\n"); ERROR("Internal error while parsing parameters\n"); ret = EXIT_FAILURE; goto fini; @@ -143,7 +146,8 @@ int main(int argc, const char **argv) ret = parse_group_name_domain(tctx, tctx->octx->addgroups); if (ret != EOK) { - DEBUG(1, "Cannot parse FQDN groups to add the user to\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot parse FQDN groups to add the user to\n"); ERROR("Groups must be in the same domain as user\n"); ret = EXIT_FAILURE; goto fini; @@ -244,7 +248,8 @@ int main(int argc, const char **argv) tctx->octx->gid); if (ret != EOK) { ERROR("Cannot create user's mail spool: %1$s\n", strerror(ret)); - DEBUG(1, "Cannot create user's mail spool: [%d][%s].\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot create user's mail spool: [%d][%s].\n", ret, strerror(ret)); ret = EXIT_FAILURE; goto fini; @@ -270,7 +275,7 @@ done: break; default: - DEBUG(1, "sysdb operation failed (%d)[%s]\n", + DEBUG(SSSDBG_CRIT_FAILURE, "sysdb operation failed (%d)[%s]\n", tctx->error, strerror(tctx->error)); ERROR("Transaction error. Could not add user.\n"); break; |