Debug: more info during server-side authentication
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 21 May 2017 15:42:05 +0000 (16:42 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 21 May 2017 15:50:40 +0000 (16:50 +0100)
src/src/smtp_in.c
test/stderr/3400

index 5ff1b7f..0ffa219 100644 (file)
@@ -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);
        }
index 99e927c..78b0e15 100644 (file)
@@ -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