Hi,

> Delivered-To: [EMAIL PROTECTED]

when I noticed, and looked up the mailing list archive for a solution I
found only messages saying, that it has to be this way. Not beeing
convinced myself I modified vdelivermail for me. This should be the
needed patch against vpopmail 5.2.1:

 --- vdelivermail.c.orig Mon Dec  2 15:11:01 2002
 +++ vdelivermail.c      Tue Dec 10 15:22:51 2002
 @@ -824,12 +825,27 @@
      return(message_size);
  }
  
 +#define PATHSIZE (500)
 +
  char *maildir_to_email(char *maildir)
  {
   static char email[256];
 + static char pwd[PATHSIZE];
 + static char maildir_abs[PATHSIZE];
   int i, j=0;
 + int rc;
   char *pnt, *last;
  
 +    if (maildir[0]!='/') {
 +       getcwd(pwd,PATHSIZE);
 +       rc=chdir(maildir);
 +       if (rc==0) {
 +         getcwd(maildir_abs,PATHSIZE);
 +          maildir=&(maildir_abs[0]);
 +         strncat(maildir,"/",PATHSIZE);
 +          chdir(pwd);
 +       }
 +    }
      memset(email, 0, sizeof(email));
      for(last=NULL, pnt=maildir; (pnt=strstr(pnt,"/Maildir/"))!=NULL; pnt+=9 ){
          last = pnt;
 @@ -843,20 +859,23 @@
  
      for( i=(pnt-maildir); (i > 1 && *(pnt-1) != '/'); --pnt, --i);
  
 +    last=pnt; /* last points to first character of user name */
 +
      for( ; (*pnt && *pnt != '/' && j < 255); ++pnt) {
          email[j++] = *pnt;
      }
  
      email[j++] = '@';
  
 -    for (last=NULL, pnt=maildir; (pnt=strstr(pnt, "/" DOMAINS_DIR "/")); 
pnt+=strlen("/" DOMAI
 NS_DIR "/")) {
 -        last = pnt;
 -    }
 +    pnt=last-2;
 +    /* pnt points to last character of domain directory */
  
 -    if(!last) return "";
 +    for (i=(pnt-maildir); (i>1 && *(pnt-1)!='/'); --pnt, --i) ;
  
 -    for( pnt = last + 9; (*pnt && *pnt != '/' && j < 255); ++pnt, ++j ) {
 -      email[j] = *pnt;
 +    /* pnt points to first character of domain name */
 +
 +    for( ; (*pnt && *pnt != '/' && j < 255); ++pnt ) {
 +      email[j++] = *pnt;
      }
  
      email[j] = 0;

DISCLAIMER: It's some time ago when I did the patching and I am no more
sure this is the right version of the patch. Please verify yourself if
it does what you expect, and no harm.

                                claudio
-- 
Claudio Nieder  .  mailto:[EMAIL PROTECTED]  .  http://www.inodes.ch
 iNodes AG  .  Friesenbergstrasse 3  .  CH-8055 Zürich  .  +41 43 960 0066

                        

Reply via email to