[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog NewSt…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog NewStuff OptionLists.txt exim/exim-src/src config.h.defaults expand.c globals.c globals.h smtp_in.c exim/exim-src/src/auths README b64decode.c
ph10 2006/02/10 14:25:44 GMT

  Modified files:
    exim-doc/doc-txt     ChangeLog NewStuff OptionLists.txt 
    exim-src/src         config.h.defaults expand.c globals.c 
                         globals.h smtp_in.c 
    exim-src/src/auths   README b64decode.c cram_md5.c 
                         cyrus_sasl.c plaintext.c spa.c 
    exim-test/confs      0002 3400 3500 3600 9300 
    exim-test/scripts/0000-Basic 0002 
    exim-test/stderr     3400 3408 3410 3500 
    exim-test/stdout     0002 
  Log:
  Add $auth1, $auth2, $auth3 variables.


  Revision  Changes    Path
  1.290     +4 -0      exim/exim-doc/doc-txt/ChangeLog
  1.82      +8 -0      exim/exim-doc/doc-txt/NewStuff
  1.16      +1 -0      exim/exim-doc/doc-txt/OptionLists.txt
  1.4       +4 -3      exim/exim-src/src/auths/README
  1.4       +1 -1      exim/exim-src/src/auths/b64decode.c
  1.4       +5 -4      exim/exim-src/src/auths/cram_md5.c
  1.4       +6 -5      exim/exim-src/src/auths/cyrus_sasl.c
  1.4       +15 -6     exim/exim-src/src/auths/plaintext.c
  1.6       +6 -3      exim/exim-src/src/auths/spa.c
  1.10      +4 -1      exim/exim-src/src/config.h.defaults
  1.54      +10 -0     exim/exim-src/src/expand.c
  1.46      +1 -0      exim/exim-src/src/globals.c
  1.34      +1 -0      exim/exim-src/src/globals.h
  1.30      +14 -8     exim/exim-src/src/smtp_in.c
  1.2       +1 -1      exim/exim-test/confs/0002
  1.2       +11 -11    exim/exim-test/confs/3400
  1.2       +4 -4      exim/exim-test/confs/3500
  1.2       +1 -0      exim/exim-test/confs/3600
  1.2       +2 -2      exim/exim-test/confs/9300
  1.2       +16 -0     exim/exim-test/scripts/0000-Basic/0002
  1.2       +3 -0      exim/exim-test/stderr/3400
  1.2       +3 -0      exim/exim-test/stderr/3408
  1.2       +8 -0      exim/exim-test/stderr/3410
  1.2       +1 -1      exim/exim-test/stderr/3500
  1.2       +4 -0      exim/exim-test/stdout/0002


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.289
  retrieving revision 1.290
  diff -u -r1.289 -r1.290
  --- ChangeLog    9 Feb 2006 14:50:58 -0000    1.289
  +++ ChangeLog    10 Feb 2006 14:25:43 -0000    1.290
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.289 2006/02/09 14:50:58 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.290 2006/02/10 14:25:43 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -115,6 +115,10 @@
         when small messages continue to be delivered. Without this change, the
         "time since failure" will always be short, possible causing more frequent
         delivery attempts for the huge message than are intended.
  +
  +PH/20 Added $auth1, $auth2, $auth3 to contain authentication data (as well as
  +      $1, $2, $3) because the numerical variables can be reset during some
  +      expansion items (e.g. "match"), thereby losing the authentication data.





  Index: NewStuff
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- NewStuff    8 Feb 2006 16:10:46 -0000    1.81
  +++ NewStuff    10 Feb 2006 14:25:43 -0000    1.82
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.81 2006/02/08 16:10:46 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.82 2006/02/10 14:25:43 ph10 Exp $


   New Features in Exim
   --------------------
  @@ -31,6 +31,14 @@
   PH/03 If quota_warn_message contains a From: header, Exim now refrains from
         adding the default one. Similarly, if it contains a Reply-To: header, the
         errors_reply_to option, if set, is not used.
  +
  +PH/04 The variables $auth1, $auth2, $auth3 are now available in authenticators,
  +      containing the same values as $1, $2, $3. The new variables are provided
  +      because the numerical variables can be reset during string expansions
  +      (for example, during a "match" operation) and so may lose the
  +      authentication data. The preferred variables are now the new ones, with
  +      the use of the numerical ones being deprecated, though the support will
  +      not be removed, at least, not for a long time.



Version 4.60

  Index: OptionLists.txt
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/OptionLists.txt,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- OptionLists.txt    9 Feb 2006 10:04:00 -0000    1.15
  +++ OptionLists.txt    10 Feb 2006 14:25:43 -0000    1.16
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/OptionLists.txt,v 1.15 2006/02/09 10:04:00 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/OptionLists.txt,v 1.16 2006/02/10 14:25:43 ph10 Exp $


   LISTS OF EXIM OPTIONS
   ---------------------
  @@ -747,6 +747,7 @@
   AUTH_CYRUS_SASL              driver       include Cyrus SASL authenticator
   AUTH_PLAINTEXT               driver       include plaintext authenticator
   AUTH_SPA                     driver       include SPA (NTLM) authenticator
  +AUTH_VARS=3                  optional*    number of $auth variables
   BASENAME_COMMAND             system**     path to basename
   BASE_62=62                   optional*    not normally changed for Unix
   BIN_DIRECTORY                mandatory    Exim binary directory


  Index: config.h.defaults
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/config.h.defaults,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- config.h.defaults    7 Feb 2006 11:19:00 -0000    1.9
  +++ config.h.defaults    10 Feb 2006 14:25:43 -0000    1.10
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/config.h.defaults,v 1.9 2006/02/07 11:19:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/config.h.defaults,v 1.10 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -9,7 +9,8 @@


/* The default settings for Exim configuration variables. A #define without
any data just defines the existence of the variable; it won't get included
-in config.h unless some value is defined in Local/Makefile. */
+in config.h unless some value is defined in Local/Makefile. If there is data,
+it's a default value. */

   #define ACL_CVARS                    20
   #define ACL_MVARS                    20
  @@ -25,6 +26,8 @@
   #define AUTH_CYRUS_SASL
   #define AUTH_PLAINTEXT
   #define AUTH_SPA
  +
  +#define AUTH_VARS                     3


#define BIN_DIRECTORY


  Index: expand.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/expand.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- expand.c    7 Feb 2006 11:19:00 -0000    1.53
  +++ expand.c    10 Feb 2006 14:25:43 -0000    1.54
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/expand.c,v 1.53 2006/02/07 11:19:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/expand.c,v 1.54 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1257,6 +1257,16 @@
       if (*endptr == 0 && n < max)
         return (acl_var[offset + n] == NULL)? US"" : acl_var[offset + n];
       }
  +  }
  +
  +/* Similarly for $auth<n> variables. */
  +
  +if (Ustrncmp(name, "auth", 4) == 0)
  +  {
  +  uschar *endptr;
  +  int n = Ustrtoul(name + 4, &endptr, 10);
  +  if (*endptr == 0 && n != 0 && n <= AUTH_VARS)
  +    return (auth_vars[n-1] == NULL)? US"" : auth_vars[n-1];
     }


/* For all other variables, search the table */

  Index: globals.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/globals.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- globals.c    7 Feb 2006 11:19:00 -0000    1.45
  +++ globals.c    10 Feb 2006 14:25:43 -0000    1.46
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/globals.c,v 1.45 2006/02/07 11:19:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/globals.c,v 1.46 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -327,6 +327,7 @@


   uschar *auth_defer_msg         = US"reason not recorded";
   uschar *auth_defer_user_msg    = US"";
  +uschar *auth_vars[AUTH_VARS];
   int     auto_thaw              = 0;
   #ifdef WITH_CONTENT_SCAN
   uschar *av_scanner             = US"sophie:/var/run/sophie";  /* AV scanner */


  Index: globals.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/globals.h,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- globals.h    7 Feb 2006 11:19:00 -0000    1.33
  +++ globals.h    10 Feb 2006 14:25:43 -0000    1.34
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/globals.h,v 1.33 2006/02/07 11:19:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/globals.h,v 1.34 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -157,6 +157,7 @@
   extern auth_instance auth_defaults;    /* Default values */
   extern uschar *auth_defer_msg;         /* Error message for log */
   extern uschar *auth_defer_user_msg;    /* Error message for user */
  +extern uschar *auth_vars[];            /* $authn variables */
   extern int     auto_thaw;              /* Auto-thaw interval */
   #ifdef WITH_CONTENT_SCAN
   extern uschar *av_scanner;             /* AntiVirus scanner to use for the malware condition */


  Index: smtp_in.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/smtp_in.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- smtp_in.c    7 Feb 2006 11:19:00 -0000    1.29
  +++ smtp_in.c    10 Feb 2006 14:25:43 -0000    1.30
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.29 2006/02/07 11:19:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.30 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -2133,7 +2133,7 @@
     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))
  @@ -2222,20 +2222,26 @@
         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


  Index: README
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/README,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- README    17 Feb 2005 11:58:27 -0000    1.3
  +++ README    10 Feb 2006 14:25:43 -0000    1.4
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-src/src/auths/README,v 1.3 2005/02/17 11:58:27 ph10 Exp $
  +$Cambridge: exim/exim-src/src/auths/README,v 1.4 2006/02/10 14:25:43 ph10 Exp $


AUTHS

@@ -44,9 +44,10 @@
to the instance block, and its second argument is the remainder of the data
from the AUTH command. The numeric variable maximum setting (expand_nmax) is
set to zero, with $0 initialized as unset. The authenticator may set up numeric
-variables according to its specification; it should leave expand_nmax set at
-the end so that they can be used for the expansion of the generic server_set_id
-option, which happens centrally.
+variables according to its (old) specification and $auth<n> variables the
+preferred ones nowadays; it should leave them set at the end so that they can
+be used for the expansion of the generic server_set_id option, which happens
+centrally.

This function has access to the SMTP input and output so that it can write
intermediate responses and read more data if necessary. There is a packaged

  Index: b64decode.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/b64decode.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- b64decode.c    7 Feb 2006 11:19:01 -0000    1.3
  +++ b64decode.c    10 Feb 2006 14:25:43 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/auths/b64decode.c,v 1.3 2006/02/07 11:19:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/auths/b64decode.c,v 1.4 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -22,7 +22,7 @@
   Arguments:
     code        points to the coded string, zero-terminated
     ptr         where to put the pointer to the result, which is in
  -              dynamic store
  +              dynamic store, and zero-terminated


   Returns:      the number of bytes in the result,
                 or -1 if the input was malformed


  Index: cram_md5.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/cram_md5.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cram_md5.c    7 Feb 2006 11:19:01 -0000    1.3
  +++ cram_md5.c    10 Feb 2006 14:25:43 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/auths/cram_md5.c,v 1.3 2006/02/07 11:19:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/auths/cram_md5.c,v 1.4 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -177,10 +177,11 @@
   if ((len = auth_b64decode(data, &clear)) < 0) return BAD64;


/* The return consists of a user name, space-separated from the CRAM-MD5
-digest, expressed in hex. Extract the user name and put it in $1. Then check
-that the remaining length is 32. */
+digest, expressed in hex. Extract the user name and put it in $auth1 and $1.
+The former is now the preferred variable; the latter is the original one. Then
+check that the remaining length is 32. */

  -expand_nstring[1] = clear;
  +auth_vars[0] = expand_nstring[1] = clear;
   while (*clear != 0 && !isspace(*clear)) clear++;
   if (!isspace(*clear)) return FAIL;
   *clear++ = 0;
  @@ -212,7 +213,7 @@
   HDEBUG(D_auth)
     {
     uschar buff[64];
  -  debug_printf("CRAM-MD5: user name = %s\n", expand_nstring[1]);
  +  debug_printf("CRAM-MD5: user name = %s\n", auth_vars[0]);
     debug_printf("          challenge = %s\n", challenge);
     debug_printf("          received  = %s\n", clear);
     Ustrcpy(buff,"          digest    = ");


  Index: cyrus_sasl.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/cyrus_sasl.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cyrus_sasl.c    5 Apr 2005 14:33:27 -0000    1.3
  +++ cyrus_sasl.c    10 Feb 2006 14:25:43 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/auths/cyrus_sasl.c,v 1.3 2005/04/05 14:33:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/auths/cyrus_sasl.c,v 1.4 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -324,11 +324,12 @@
       }
     else if(rc==SASL_OK)
       {
  -    /* get the username and copy it into $1 */
  -    rc=sasl_getprop(conn, SASL_USERNAME, (const void **)(&out2));
  -    expand_nstring[1]=string_copy(out2);
  -    expand_nlength[1]=Ustrlen(expand_nstring[1]);
  -    expand_nmax=1;
  +    /* Get the username and copy it into $auth1 and $1. The former is now the
  +    preferred variable; the latter is the original variable. */
  +    rc = sasl_getprop(conn, SASL_USERNAME, (const void **)(&out2));
  +    auth_vars[0] = expand_nstring[1] = string_copy(out2);
  +    expand_nlength[1] = Ustrlen(expand_nstring[1]);
  +    expand_nmax = 1;


       HDEBUG(D_auth)
         debug_printf("Cyrus SASL %s authentiction succeeded for %s\n", ob->server_mech, out2);


  Index: plaintext.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/plaintext.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- plaintext.c    7 Feb 2006 11:19:01 -0000    1.3
  +++ plaintext.c    10 Feb 2006 14:25:43 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/auths/plaintext.c,v 1.3 2006/02/07 11:19:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/auths/plaintext.c,v 1.4 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -87,14 +87,16 @@
     }


/* If data was supplied on the AUTH command, decode it, and split it up into
-multiple items at binary zeros. If the data consists of the string "=" it
-indicates a single, empty string. */
+multiple items at binary zeros. The strings are put into $auth1, $auth2, etc,
+up to a maximum. To retain backwards compatibility, they are also put int $1,
+$2, etc. If the data consists of the string "=" it indicates a single, empty
+string. */

   if (*data != 0)
     {
     if (Ustrcmp(data, "=") == 0)
       {
  -    expand_nstring[++expand_nmax] = US"";
  +    auth_vars[0] = expand_nstring[++expand_nmax] = US"";
       expand_nlength[expand_nmax] = 0;
       }
     else
  @@ -103,6 +105,7 @@
       end = clear + len;
       while (clear < end && expand_nmax < EXPAND_MAXN)
         {
  +      if (expand_nmax < AUTH_VARS) auth_vars[expand_nmax] = clear;
         expand_nstring[++expand_nmax] = clear;
         while (*clear != 0) clear++;
         expand_nlength[expand_nmax] = clear++ - expand_nstring[expand_nmax];
  @@ -126,6 +129,7 @@
     /* This loop must run at least once, in case the length is zero */
     do
       {
  +    if (expand_nmax < AUTH_VARS) auth_vars[expand_nmax] = clear;
       expand_nstring[++expand_nmax] = clear;
       while (*clear != 0) clear++;
       expand_nlength[expand_nmax] = clear++ - expand_nstring[expand_nmax];
  @@ -133,9 +137,9 @@
     while (clear < end && expand_nmax < EXPAND_MAXN);
     }


-/* We now have a number of items of data in $1, $2, etc. Match against the
-decoded data by expanding the condition. Also expand the id to set if
-authentication succeeds. */
+/* We now have a number of items of data in $auth1, $auth2, etc (and also, for
+compatibility, in $1, $2, etc). Match against the decoded data by expanding the
+condition. */

cond = expand_string(ob->server_condition);

  @@ -143,6 +147,11 @@
     {
     int i;
     debug_printf("%s authenticator:\n", ablock->name);
  +  for (i = 0; i < AUTH_VARS; i++)
  +    {
  +    if (auth_vars[i] != NULL)
  +      debug_printf("  $auth%d = %s\n", i + 1, auth_vars[i]);
  +    }
     for (i = 1; i <= expand_nmax; i++)
       debug_printf("  $%d = %.*s\n", i, expand_nlength[i], expand_nstring[i]);
     debug_print_string(ablock->server_debug_string);    /* customized debug */


  Index: spa.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/auths/spa.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- spa.c    7 Feb 2006 11:19:01 -0000    1.5
  +++ spa.c    10 Feb 2006 14:25:43 -0000    1.6
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/auths/spa.c,v 1.5 2006/02/07 11:19:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/auths/spa.c,v 1.6 2006/02/10 14:25:43 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -162,8 +162,6 @@
     return FAIL;
     }


-/* get username and put it in $1 */
-
/***************************************************************
PH 07-Aug-2003: The original code here was this:

@@ -194,9 +192,14 @@

/***************************************************************/

  -expand_nstring[1] = msgbuf;
  +/* Put the username in $auth1 and $1. The former is now the preferred variable;
  +the latter is the original variable. */
  +
  +auth_vars[0] = expand_nstring[1] = msgbuf;
   expand_nlength[1] = Ustrlen(msgbuf);
   expand_nmax = 1;
  +
  +debug_print_string(ablock->server_debug_string);    /* customized debug */


/* look up password */


  Index: 0002
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/confs/0002,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 0002    7 Feb 2006 10:34:25 -0000    1.1
  +++ 0002    10 Feb 2006 14:25:43 -0000    1.2
  @@ -14,7 +14,7 @@


# ----- Main settings -----

-domainlist dlist = *.aa.bb : ^\Nxxx
+domainlist dlist = *.aa.bb : ^\Nxxx(.*)
hostlist hlist = V4NET.11.12.13 : iplsearch;DIR/aux-fixed/0002.iplsearch
headers_charset = iso-8859-8


  Index: 3400
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/confs/3400,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3400    7 Feb 2006 10:34:26 -0000    1.1
  +++ 3400    10 Feb 2006 14:25:43 -0000    1.2
  @@ -85,46 +85,46 @@
     driver = plaintext
     public_name = PLAIN
     server_condition = "\
  -    ${if and {{eq{$2}{userx}}{eq{$3}{secret}}}{yes}{no}}"
  -  server_set_id = $2
  +    ${if and {{eq{$auth2}{userx}}{eq{$auth3}{secret}}}{yes}{no}}"
  +  server_set_id = $auth2


   extended_plain:
     driver = plaintext
     public_name = EXPLAIN
     server_prompts = :
     server_condition = "\
  -    ${if and {{eq{$2}{userx}}{eq{$3}{secret}}}{yes}{no}}"
  -  server_set_id = $2
  +    ${if and {{eq{$auth2}{userx}}{eq{$auth3}{secret}}}{yes}{no}}"
  +  server_set_id = $auth2


   expanded_prompt_plain:
     driver = plaintext
     public_name = EXPANDED
     server_prompts = $primary_hostname
     server_condition = "\
  -    ${if and {{eq{$2}{userx}}{eq{$3}{secret}}}{yes}{no}}"
  -  server_set_id = $2
  +    ${if and {{eq{$auth2}{userx}}{eq{$auth3}{secret}}}{yes}{no}}"
  +  server_set_id = $auth2


   expanded_prompt_plain_fail:
     driver = plaintext
     public_name = EXPANDFAIL
     server_prompts = $nonexistent
     server_condition = "\
  -    ${if and {{eq{$2}{userx}}{eq{$3}{secret}}}{yes}{no}}"
  -  server_set_id = $2
  +    ${if and {{eq{$auth2}{userx}}{eq{$auth3}{secret}}}{yes}{no}}"
  +  server_set_id = $auth2


   defer:
     driver = plaintext
     public_name = DEFER
     server_condition = "account suspended"
  -  server_set_id = $2
  +  server_set_id = $auth2


   login:
     driver = plaintext
     public_name = LOGIN
     server_prompts = "User Name : Password "
     server_condition = "\
  -    ${if and {{eq{$1}{userx}}{eq{$2}{secret}}}{yes}{no}}"
  -  server_set_id = $1
  +    ${if and {{eq{$auth1}{userx}}{eq{$auth2}{secret}}}{yes}{no}}"
  +  server_set_id = $auth1



# ----- Routers -----

  Index: 3500
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/confs/3500,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3500    7 Feb 2006 10:34:26 -0000    1.1
  +++ 3500    10 Feb 2006 14:25:43 -0000    1.2
  @@ -76,10 +76,10 @@
   cram_md5:
     driver = cram_md5
     public_name = CRAM-MD5
  -  server_debug_print = +++CRAM-MD5 \$1="$1" \$2=\"$2" \$3="$3"
  -  server_secret = "${if eq{$1}{tim}{tanstaaftanstaaf}\
  -    {${if eq{$1}{userx}{secret}fail}}}"
  -  server_set_id = $1
  +  server_debug_print = +++CRAM-MD5 \$auth1="$auth1" \$auth2=\"$auth2" \$auth3="$auth3"
  +  server_secret = "${if eq{$auth1}{tim}{tanstaaftanstaaf}\
  +    {${if eq{$auth1}{userx}{secret}fail}}}"
  +  server_set_id = $auth1





  Index: 3600
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/confs/3600,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3600    7 Feb 2006 10:34:26 -0000    1.1
  +++ 3600    10 Feb 2006 14:25:43 -0000    1.2
  @@ -45,6 +45,7 @@
     public_name = NTLM
     client_password = $sender_address
     client_username = username
  +  server_debug_print = +++SPA \$auth1="$auth1"
     server_password = ok@???




  Index: 9300
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/confs/9300,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 9300    7 Feb 2006 10:34:26 -0000    1.1
  +++ 9300    10 Feb 2006 14:25:43 -0000    1.2
  @@ -21,11 +21,11 @@
   sasl1:
     driver = cyrus_sasl
     public_name = ANONYMOUS
  -  server_set_id = $1
  +  server_set_id = $auth1


   sasl2:
     driver = cyrus_sasl
     public_name = PLAIN
  -  server_set_id = $1
  +  server_set_id = $auth1


# End

  Index: 0002
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/scripts/0000-Basic/0002,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 0002    7 Feb 2006 10:54:33 -0000    1.1
  +++ 0002    10 Feb 2006 14:25:44 -0000    1.2
  @@ -269,6 +269,22 @@
   match_domain:    ${if match_domain{xxxyz}{+dlist}{yes}{no}}
   match_domain:    ${if match_domain{xyz}{+dlist}{yes}{no}}


+${if match{x@???}{^(.*)} \
+ { \
+ >$1< \
+ ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
+ >$1< \
+ } \
+ { CAN'T HAPPEN}}
+
+${if match{x@xxxabc}{^(.*)} \
+ { \
+ >$1< \
+ ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
+ >$1< \
+ } \
+ { CAN'T HAPPEN}}
+
match_address: ${if match_address{x@???}{p@q:*@y.z}{yes}{no}}
match_address: ${if match_address{x@???}{p@q:x@*.z}{yes}{no}}


  Index: 3400
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stderr/3400,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3400    7 Feb 2006 10:47:31 -0000    1.1
  +++ 3400    10 Feb 2006 14:25:44 -0000    1.2
  @@ -109,6 +109,7 @@
   >>> deny: condition test succeeded
   LOG: H=(test.host) [10.0.0.1] F=<junk@???> rejected RCPT <userx@???>: authentication required
   >>> mylogin authenticator:
  +>>>   $auth1 = userx secret
   >>>   $1 = userx secret
   >>> +++MYLOGIN $1="userx secret" $2="" $3=""
   >>> expanded string: yes
  @@ -273,6 +274,7 @@
   >>> accept: endpass encountered - denying access
   LOG: H=(test.host) [10.0.0.3] F=<junk@???> rejected RCPT <userx@???>: authentication required
   >>> mylogin authenticator:
  +>>>   $auth1 = userx secret
   >>>   $1 = userx secret
   >>> +++MYLOGIN $1="userx secret" $2="" $3=""
   >>> expanded string: yes
  @@ -367,6 +369,7 @@
   250 HELP
   SMTP<< auth mylogin dXNlcnggc2VjcmV0
   mylogin authenticator:
  +  $auth1 = userx secret
     $1 = userx secret
   +++MYLOGIN $1="userx secret" $2="" $3=""
   expanded string: yes


  Index: 3408
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stderr/3408,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3408    7 Feb 2006 10:47:31 -0000    1.1
  +++ 3408    10 Feb 2006 14:25:44 -0000    1.2
  @@ -51,6 +51,9 @@
   >>> host in pipelining_advertise_hosts? yes (matched "*")
   >>> host in auth_advertise_hosts? yes (matched "*")
   >>> plain authenticator:
  +>>>   $auth1 = 
  +>>>   $auth2 = userx
  +>>>   $auth3 = secret
   >>>   $1 = 
   >>>   $2 = userx
   >>>   $3 = secret


  Index: 3410
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stderr/3410,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3410    7 Feb 2006 10:47:31 -0000    1.1
  +++ 3410    10 Feb 2006 14:25:44 -0000    1.2
  @@ -16,6 +16,9 @@
   >>> host in pipelining_advertise_hosts? yes (matched "*")
   >>> host in auth_advertise_hosts? yes (matched "*")
   >>> auth1 authenticator:
  +>>>   $auth1 = 
  +>>>   $auth2 = userx
  +>>>   $auth3 = secret
   >>>   $1 = 
   >>>   $2 = userx
   >>>   $3 = secret
  @@ -43,6 +46,9 @@
   >>> host in pipelining_advertise_hosts? yes (matched "*")
   >>> host in auth_advertise_hosts? yes (matched "*")
   >>> auth1 authenticator:
  +>>>   $auth1 = 
  +>>>   $auth2 = userx
  +>>>   $auth3 = secret
   >>>   $1 = 
   >>>   $2 = userx
   >>>   $3 = secret
  @@ -64,6 +70,8 @@
   >>> host in pipelining_advertise_hosts? yes (matched "*")
   >>> host in auth_advertise_hosts? yes (matched "*")
   >>> auth2 authenticator:
  +>>>   $auth1 = userx
  +>>>   $auth2 = secret
   >>>   $1 = userx
   >>>   $2 = secret
   >>> expanded string: yes


  Index: 3500
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stderr/3500,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 3500    7 Feb 2006 10:47:31 -0000    1.1
  +++ 3500    10 Feb 2006 14:25:44 -0000    1.2
  @@ -23,7 +23,7 @@
   >>> host in pipelining_advertise_hosts? yes (matched "*")
   >>> host in "10.0.0.1"? yes (matched "10.0.0.1")
   >>> host in auth_advertise_hosts? yes (matched "+auth_hosts")
  ->>> +++CRAM-MD5 $1="tim" $2="" $3=""
  +>>> +++CRAM-MD5 $auth1="tim" $auth2="" $auth3=""
   >>> CRAM-MD5: user name = tim
   >>>           challenge = <1896.697170952@???>
   >>>           received  = b913a602c7eda7a495b4e6e7334d3890


  Index: 0002
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/stdout/0002,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 0002    7 Feb 2006 10:47:37 -0000    1.1
  +++ 0002    10 Feb 2006 14:25:44 -0000    1.2
  @@ -250,6 +250,10 @@
   > match_domain:    yes
   > match_domain:    no

>
+> >x@???< [] >x@???<
+>
+> >x@xxxabc< [] >x@xxxabc<
+>
> match_address: yes
> match_address: yes
>