Problems with lmtp delivery on 2.2.2-BETA

Ken Murchison ken at oceana.com
Thu Jan 8 13:28:18 EST 2004


Matthew Hodgson wrote:

> Ken Murhcison wrote:
> 
> 
>>Matthew Hodgson wrote:
>>
>>
>>
>>>Looking at the process_recipient() code in lmtpengine.c,
>>
>>I'm not sure
>>
>>>that the
>>>quote-string parsing has been updated fully to reflect
>>
>>virtual domains - so
>>
>>>I've fiddled around and come up with a version based on the
>>
>>existing
>>
>>>code, and
>>>also a complete rewrite.  I enclose the latter as a patch here; it
>>>hasn't been
>>>rigorously tested (at all), but has fixed my particular 
>>
>>problem.  If anyone
>>
>>>has interest in the other version, just say - any feedback & flames
>>>appreciated.
>>
>>I'm looking at your current patch now to make sure it looks
>>sane before 
>>I commit it.  If you have an alternate patch, I'd like to see it also.
>>
> 
> 
> Hi Ken,
> 
> Be sure to look at the 2nd version of the patch I submitted to the list; the
> 1st one included a few rather embarassing bugs.
> 
> I've abandoned the alternative patch (the minimal extension of the existing
> code), as ensuring that forcedowncase vaguely works with quoted-strings as
> well as virtual domains was becoming too clunky, and I'm now depending on it
> for the installation here.  Rather than ending up with a load of unwrapped
> states, I suspect the better idea is to chuck a few state flags in as I did
> with the submitted patch, I hope.

One thing you missed in you patch was the downcasing of the domain for 
something like user+detail at domain.  I've written my own patch, based on 
yours which I *think* handles all cases (at least it doesn in my test 
harness).  Try the attached patch and let me know how it works before I 
commit it.


> In other news, the latest CVS doesn't compile from clean when using a
> berkeley backend; HAVE_BDB needs to be #defined in config.h at some point to
> avoid disturbing fatal errors of the form:
> Jan  8 16:51:16 foo imap[11302]: Fatal error: cyrusdb backend

Any time that configure.in is updated, you need to re-make the configure 
script:

rm configure
sh SMakefile
./configure ...


Any time that a Makefile.in is updated, you should re-run configure.

-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp
-------------- next part --------------
Index: lmtpengine.c
===================================================================
RCS file: /afs/andrew/system/cvs/src/cyrus/imap/lmtpengine.c,v
retrieving revision 1.98
diff -c -r1.98 lmtpengine.c
*** lmtpengine.c	2 Jan 2004 20:34:10 -0000	1.98
--- lmtpengine.c	8 Jan 2004 18:25:03 -0000
***************
*** 756,761 ****
--- 756,762 ----
      int r, sl;
      address_data_t *ret = (address_data_t *) xmalloc(sizeof(address_data_t));
      int forcedowncase = config_getswitch(IMAPOPT_LMTP_DOWNCASE_RCPT);
+     int quoted, detail;
  
      assert(addr != NULL && msg != NULL);
  
***************
*** 781,817 ****
  	addr++;
      }
      
!     if (*addr == '\"') {
! 	addr++;
! 	while (*addr && *addr != '\"') {
! 	    if (*addr == '\\') addr++;
! 	    *dest++ = *addr++;
  	}
!     }
!     else {
! 	if(forcedowncase) {
! 	    /* We should downcase the localpart up to the first + */
! 	    while(*addr != '@' && *addr != '>' && *addr != '+') {
! 		if(*addr == '\\') addr++;
! 		*dest++ = TOLOWER(*addr++);
! 	    }
! 	    if (*addr == '+') {
! 	      while(*addr != '@' && *addr != '>') {
! 		if(*addr == '\\') addr++;
! 		*dest++ = *addr++;
! 	      }
! 	    }
! 	    while ((config_virtdomains || *addr != '@') && *addr != '>') {
! 		if(*addr == '\\') addr++;
! 		*dest++ = TOLOWER(*addr++);
! 	    }
  	} else {
! 	  /* Now finish the remainder of the localpart */
! 	  while ((config_virtdomains || *addr != '@') && *addr != '>') {
! 	      if (*addr == '\\') addr++;
! 	      *dest++ = *addr++;
! 	  }
!        }
      }
      *dest = '\0';
  	
--- 782,815 ----
  	addr++;
      }
      
!     quoted = detail = 0;
!     while (*addr &&
! 	   (quoted ||
! 	    ((config_virtdomains || *addr != '@') && *addr != '>'))) {
! 	/* start/end of quoted localpart, skip the quote */
! 	if (*addr == '\"') {
! 	    quoted = !quoted;
! 	    addr++;
! 	    continue;
  	}
! 
! 	/* escaped char, pass it through */
! 	if (*addr == '\\') {
! 	    addr++;
! 	    if (!*addr) break;
  	} else {
! 	    /* start of detail */
! 	    if (*addr == '+') detail = 1;
! 
! 	    /* end of localpart (unless quoted) */
! 	    if (*addr == '@' && !quoted) detail = 0;
! 	}
! 
! 	/* downcase everything accept the detail */
! 	if (forcedowncase && !detail)
! 	    *dest++ = TOLOWER(*addr++);
! 	else
! 	    *dest++ = *addr++;
      }
      *dest = '\0';
  	


More information about the Info-cyrus mailing list