From 8b6b06fe3e009cb89ae7923b890e75f9dcd50118 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 21 May 2017 16:42:05 +0100 Subject: [PATCH] Debug: more info during server-side authentication --- src/src/smtp_in.c | 40 ++++++++++++++++++++++++---------------- test/stderr/3400 | 7 +++++++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 5ff1b7f32..0ffa21939 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -4230,26 +4230,34 @@ while (done <= 0) auth_instance *au; BOOL first = TRUE; for (au = auths; au; au = au->next) - if (au->server && (au->advertise_condition == NULL || - expand_check_condition(au->advertise_condition, au->name, - US"authenticator"))) + { + au->advertised = FALSE; + if (au->server) { - int saveptr; - if (first) + DEBUG(D_auth+D_expand) debug_printf_indent( + "Evaluating advertise_condition for %s athenticator\n", + au->public_name); + if ( !au->advertise_condition + || expand_check_condition(au->advertise_condition, au->name, + US"authenticator") + ) { - s = string_catn(s, &size, &ptr, smtp_code, 3); - s = string_catn(s, &size, &ptr, US"-AUTH", 5); - first = FALSE; - auth_advertised = TRUE; + int saveptr; + if (first) + { + s = string_catn(s, &size, &ptr, smtp_code, 3); + s = string_catn(s, &size, &ptr, US"-AUTH", 5); + first = FALSE; + auth_advertised = TRUE; + } + saveptr = ptr; + s = string_catn(s, &size, &ptr, US" ", 1); + s = string_cat (s, &size, &ptr, au->public_name); + while (++saveptr < ptr) s[saveptr] = toupper(s[saveptr]); + au->advertised = TRUE; } - saveptr = ptr; - s = string_catn(s, &size, &ptr, US" ", 1); - s = string_cat (s, &size, &ptr, au->public_name); - while (++saveptr < ptr) s[saveptr] = toupper(s[saveptr]); - au->advertised = TRUE; } - else - au->advertised = FALSE; + } if (!first) s = string_catn(s, &size, &ptr, US"\r\n", 2); } diff --git a/test/stderr/3400 b/test/stderr/3400 index 99e927c6b..78b0e158f 100644 --- a/test/stderr/3400 +++ b/test/stderr/3400 @@ -440,6 +440,13 @@ host in "10.0.0.1"? no (end of list) host in "10.0.0.4"? no (end of list) host in "10.0.0.3 : 10.0.0.4"? no (end of list) host in auth_advertise_hosts? yes (matched "10.0.0.5") +Evaluating advertise_condition for mylogin athenticator +Evaluating advertise_condition for PLAIN athenticator +Evaluating advertise_condition for EXPLAIN athenticator +Evaluating advertise_condition for EXPANDED athenticator +Evaluating advertise_condition for EXPANDFAIL athenticator +Evaluating advertise_condition for DEFER athenticator +Evaluating advertise_condition for LOGIN athenticator host in chunking_advertise_hosts? no (end of list) SMTP>> 250-myhost.test.ex Hello CALLER at testing.testing [10.0.0.5] 250-SIZE 52428800 -- 2.30.2