summaryrefslogtreecommitdiffstats
path: root/src/providers/krb5/krb5_utils.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-02-12 10:12:59 -0500
committerJakub Hrozek <jhrozek@redhat.com>2014-05-02 10:58:33 +0200
commit46c28ba3044c2121c2c0af4493ac655dcb41e0e6 (patch)
tree376633177afd84f0b46a8e2e5533f5337a38cf95 /src/providers/krb5/krb5_utils.c
parentdad68b3284228a38b4beb06946701e8795980966 (diff)
downloadsssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.tar.gz
sssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.tar.xz
sssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.zip
Update DEBUG* invocations to use new levels
Use a script (identical to commit 83bf46f4066e3d5e838a32357c201de9bd6ecdfd) 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
Diffstat (limited to 'src/providers/krb5/krb5_utils.c')
-rw-r--r--src/providers/krb5/krb5_utils.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index bbb4a31ba..5fa750680 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -218,7 +218,7 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
bool rerun;
if (template == NULL) {
- DEBUG(1, "Missing template.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "Missing template.\n");
return NULL;
}
@@ -227,13 +227,13 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
copy = talloc_strdup(tmp_ctx, template);
if (copy == NULL) {
- DEBUG(1, "talloc_strdup failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed.\n");
goto done;
}
result = talloc_strdup(tmp_ctx, "");
if (result == NULL) {
- DEBUG(1, "talloc_strdup failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed.\n");
goto done;
}
@@ -242,7 +242,8 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
*n = '\0';
n++;
if ( *n == '\0' ) {
- DEBUG(1, "format error, single %% at the end of the template.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "format error, single %% at the end of the template.\n");
goto done;
}
@@ -253,7 +254,8 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
switch (action) {
case 'u':
if (kr->pd->user == NULL) {
- DEBUG(1, "Cannot expand user name template "
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Cannot expand user name template "
"because user name is empty.\n");
goto done;
}
@@ -270,7 +272,7 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
break;
case 'U':
if (kr->uid <= 0) {
- DEBUG(1, "Cannot expand uid template "
+ DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand uid template "
"because uid is invalid.\n");
goto done;
}
@@ -279,7 +281,8 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
break;
case 'p':
if (kr->upn == NULL) {
- DEBUG(1, "Cannot expand user principal name template "
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Cannot expand user principal name template "
"because upn is empty.\n");
goto done;
}
@@ -291,14 +294,15 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
case 'r':
dummy = dp_opt_get_string(kr->krb5_ctx->opts, KRB5_REALM);
if (dummy == NULL) {
- DEBUG(1, "Missing kerberos realm.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "Missing kerberos realm.\n");
goto done;
}
result = talloc_asprintf_append(result, "%s%s", p, dummy);
break;
case 'h':
if (kr->homedir == NULL) {
- DEBUG(1, "Cannot expand home directory template "
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Cannot expand home directory template "
"because the path is not available.\n");
goto done;
}
@@ -309,31 +313,35 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
cache_dir_tmpl = dp_opt_get_string(kr->krb5_ctx->opts,
KRB5_CCACHEDIR);
if (cache_dir_tmpl == NULL) {
- DEBUG(1, "Missing credential cache directory.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Missing credential cache directory.\n");
goto done;
}
dummy = expand_ccname_template(tmp_ctx, kr, cache_dir_tmpl,
false, case_sensitive);
if (dummy == NULL) {
- DEBUG(1, "Expanding credential cache directory "
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Expanding credential cache directory "
"template failed.\n");
goto done;
}
result = talloc_asprintf_append(result, "%s%s", p, dummy);
talloc_zfree(dummy);
} else {
- DEBUG(1, "'%%d' is not allowed in this template.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "'%%d' is not allowed in this template.\n");
goto done;
}
break;
case 'P':
if (!file_mode) {
- DEBUG(1, "'%%P' is not allowed in this template.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "'%%P' is not allowed in this template.\n");
goto done;
}
if (kr->pd->cli_pid == 0) {
- DEBUG(1, "Cannot expand PID template "
+ DEBUG(SSSDBG_CRIT_FAILURE, "Cannot expand PID template "
"because PID is not available.\n");
goto done;
}
@@ -382,13 +390,14 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
}
break;
default:
- DEBUG(1, "format error, unknown template [%%%c].\n", *n);
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "format error, unknown template [%%%c].\n", *n);
goto done;
}
}
if (result == NULL) {
- DEBUG(1, "talloc_asprintf_append failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf_append failed.\n");
goto done;
}
@@ -397,7 +406,7 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
result = talloc_asprintf_append(result, "%s", p);
if (result == NULL) {
- DEBUG(1, "talloc_asprintf_append failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf_append failed.\n");
goto done;
}
@@ -634,7 +643,7 @@ errno_t get_ccache_file_data(const char *ccache_file, const char *client_name,
kerr = krb5_init_context(&ctx);
if (kerr != 0) {
- DEBUG(1, "krb5_init_context failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "krb5_init_context failed.\n");
goto done;
}
@@ -652,7 +661,7 @@ errno_t get_ccache_file_data(const char *ccache_file, const char *client_name,
realm_length, realm_name);
if (server_name == NULL) {
kerr = KRB5_CC_NOMEM;
- DEBUG(1, "talloc_asprintf failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
goto done;
}