Add $auth1, $auth2, $auth3 variables.
[exim.git] / src / src / smtp_in.c
index 01f4a09ef57410e3e69bac7a335281364f42c82d..04bffd017e345ab103ab31e97cee711b5e166569 100644 (file)
@@ -1,10 +1,10 @@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.26 2005/09/13 11:13:27 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.30 2006/02/10 14:25:43 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2005 */
+/* Copyright (c) University of Cambridge 1995 - 2006 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions for handling an incoming SMTP call. */
@@ -841,7 +841,9 @@ sender_rate = sender_rate_limit = sender_rate_period = NULL;
 ratelimiters_mail = NULL;           /* Updated by ratelimit ACL condition */
                    /* Note that ratelimiters_conn persists across resets. */
 
-for (i = 0; i < ACL_M_MAX; i++) acl_var[ACL_C_MAX + i] = NULL;
+/* The message variables follow the connection variables. */
+
+for (i = 0; i < ACL_MVARS; i++) acl_var[ACL_CVARS + i] = NULL;
 
 /* The message body variables use malloc store. They may be set if this is
 not the first message in an SMTP session and the previous message caused them
@@ -1131,15 +1133,6 @@ int size = 256;
 int i, ptr;
 uschar *p, *s, *ss;
 
-/* If we are running in the test harness, and the incoming call is from
-127.0.0.2 (sic), have a short delay. This makes it possible to test handling of
-input sent too soon (before the banner is output). */
-
-if (running_in_test_harness &&
-    sender_host_address != NULL &&
-    Ustrcmp(sender_host_address, "127.0.0.2") == 0)
-  sleep(1);
-
 /* Default values for certain variables */
 
 helo_seen = esmtp = helo_accept_junk = FALSE;
@@ -1162,7 +1155,7 @@ tls_advertised = FALSE;
 
 /* Reset ACL connection variables */
 
-for (i = 0; i < ACL_C_MAX; i++) acl_var[i] = NULL;
+for (i = 0; i < ACL_CVARS; i++) acl_var[i] = NULL;
 
 /* Allow for trailing 0 in the command buffer. */
 
@@ -2140,7 +2133,7 @@ while (done <= 0)
   pid_t pid;
   int start, end, sender_domain, recipient_domain;
   int ptr, size, rc;
-  int c;
+  int c, i;
   auth_instance *au;
 
   switch(smtp_read_command(TRUE))
@@ -2229,20 +2222,26 @@ while (done <= 0)
       break;
       }
 
-    /* Run the checking code, passing the remainder of the command
-    line as data. Initialize $0 empty. The authenticator may set up
-    other numeric variables. Afterwards, have a go at expanding the set_id
-    string, even if authentication failed - for bad passwords it can be useful
-    to log the userid. On success, require set_id to expand and exist, and
-    put it in authenticated_id. Save this in permanent store, as the working
-    store gets reset at HELO, RSET, etc. */
+    /* Run the checking code, passing the remainder of the command line as
+    data. Initials the $auth<n> variables as empty. Initialize $0 empty and set
+    it as the only set numerical variable. The authenticator may set $auth<n>
+    and also set other numeric variables. The $auth<n> variables are preferred
+    nowadays; the numerical variables remain for backwards compatibility.
+
+    Afterwards, have a go at expanding the set_id string, even if
+    authentication failed - for bad passwords it can be useful to log the
+    userid. On success, require set_id to expand and exist, and put it in
+    authenticated_id. Save this in permanent store, as the working store gets
+    reset at HELO, RSET, etc. */
 
+    for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL;
     expand_nmax = 0;
     expand_nlength[0] = 0;   /* $0 contains nothing */
 
     c = (au->info->servercode)(au, smtp_cmd_argument);
     if (au->set_id != NULL) set_id = expand_string(au->set_id);
     expand_nmax = -1;        /* Reset numeric variables */
+    for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL;   /* Reset $auth<n> */
 
     /* The value of authenticated_id is stored in the spool file and printed in
     log lines. It must not contain binary zeros or newline characters. In