Working Vacation?? [solved?]

Mark Keasling mark at air.co.jp
Thu Jan 23 06:02:42 EST 2003


Hi,

Sieve is not sending vacation replies.  Why?  Here's my stab...
in the dark...

Sieve vacation wants a domain part for the rcpt to address
for its "Was the message send directly to me as opposed to
being sent to an alias or got to me some other way" check.
Being sent directly to me means my address will appear verbatim
in either the TO, CC or BCC headers.  It is comparing the
stmp envelope's TO to the addresses in the message header.

Sendmail is removing the domain part from smtp envelope TO
addresses (RCPT TO) when they are sent to the local deliverer
in my case LMTP.  Apparently, there is no way to avoid this
obnoxious behavior.  Hacking on sendmail.cf has had no effect.

No vacation reply gets sent because lmtpd substitutes "unspecified-domain"
for the domain which was removed by sendmail.  Its "to me" check
fails because user at unspecified-domain is definitely not in the
message's headers.

What I did was to:
  add parseaddr_getdomain() to lib/parseaddr.c which retrieves
    the domain name.  It returns "unspecified-domain" if no domain
    name was set.
  add parseaddr_setdomain(domain) to lib/parseaddr.c which sets
    the domain name.
  call parseaddr_setdomain(config_servername) in imap/config.c
    after config_servername has been set.
  call parseaddr_getdomain() in lib/parseaddr.c and sieve/message.c
    before setting "unspecified-domain".

The following patches seem to fix the sieve vacation problem.
It would be nice if these patches could be incorporated into
the main source so that other people who use sendmail can have
vacations too.  If someone spots a problem with these patches
or notices a deficiency PLEASE let me know how they should be
fixed as I'll be putting them into production use RSN.

There will be some interactions with aliases where user at domain.com
user at subdomain.domain.com and user at hostname.subdomain.domain.com
are all equivalent and all are used.  Mail sent to one address will
get vacation replies while mail sent to the others will not.  I
know of no simple way to solve this unless sendmail is kind enough
to rewrite the addresses in the message header.

----lib/parseaddr.h----
*** parseaddr.h.old     Thu Jan 23 18:14:19 2003
--- parseaddr.h Thu Jan 23 17:53:59 2003
***************
*** 64,69 ****
--- 64,71 ----
  
  extern void parseaddr_list P((const char *s, struct address **addrp));
  extern void parseaddr_free P((struct address *addr));
+ extern void parseaddr_setdomain P((const char *domain));
+ extern char * parseaddr_getdomain ();
  
  
  #endif /* INCLUDED_PARSEADDR_H */
----lib/parseaddr.c----
*** parseaddr.c.old     Thu Jan 23 18:15:38 2003
--- parseaddr.c Thu Jan 23 17:56:11 2003
***************
*** 189,194 ****
--- 189,197 ----
  
      newaddr->mailbox = mailbox;
  
+     if ( domain && !*domain) {
+       domain = parseaddr_getdomain();
+     }
      if (domain && !*domain) {
        domain = parseaddr_unspecified_domain;
      }
***************
*** 364,367 ****
--- 367,389 ----
            return c;
        }
      }
  }
+ 
+ /*
+  * manage the default domain
+  */
+ static char *parseaddr_domain_name = (char *)0;
+ 
+ void parseaddr_setdomain (domain)
+      const char * domain ;
+ {
+     if (parseaddr_domain_name) free(parseaddr_domain_name);
+     if (domain && *domain) parseaddr_domain_name = xstrdup(domain) ;
+     else parseaddr_domain_name = (char*)0;
+ }
+ 
+ char * parseaddr_getdomain ()
+ {
+     if (parseaddr_domain_name) return parseaddr_domain_name;
+     return "unspecified-domain";
+ }
----sieve/message.c----
*** message.c.old       Thu Jan 23 19:15:02 2003
--- message.c   Thu Jan 23 17:16:15 2003
***************
*** 460,466 ****
  #define U_USER "unknown-user"
            if (a->mailbox || a->domain) {
                char *m = a->mailbox ? a->mailbox : U_USER;
!               char *d = a->domain ? a->domain : U_DOMAIN;
  
                am->freeme = (char *) xmalloc(strlen(m) + strlen(d) + 2);
  
--- 460,468 ----
  #define U_USER "unknown-user"
            if (a->mailbox || a->domain) {
                char *m = a->mailbox ? a->mailbox : U_USER;
!               /* char *d = a->domain ? a->domain : U_DOMAIN; */
+               char *d = a->domain ? a->domain : parseaddr_getdomain();
+               if (!d || !*d) d = U_DOMAIN;
  
                am->freeme = (char *) xmalloc(strlen(m) + strlen(d) + 2);
  
--------

Many thanks to all the busy people, in particular Ken Murchison,
who have provided assistance without recompense.  Your accomulated
wisdom pointed me in the right direction.  You have my humble thanks
such as they may be.

Regards,
Mark Keasling <mark at air.co.jp>





More information about the Info-cyrus mailing list