On Fri, Jul 30, Anders Norrbring wrote:

> I'm working on adapting cyrus-imapd 2.2.8 for use with SuSE 9.1, and I've
> ran into a patch that I can't make up my mind about..
> 
> Can somebody please help me out?  Is it at all needed, and if so, how should
> I adapt it to the new cyrus-imapd?  The code is heavily updated since v2.2.3
> that the patch is originally intended for.

This is my latest version (untested)

-- 
With best regards,

Carsten Hoeger
--- imap/lmtpengine.c
+++ imap/lmtpengine.c   2004/05/31 12:24:07
@@ -817,6 +817,8 @@
     address_data_t *ret = (address_data_t *) xmalloc(sizeof(address_data_t));
     int forcedowncase = config_getswitch(IMAPOPT_LMTP_DOWNCASE_RCPT);
     int quoted, detail;
+    char *luser_relay = NULL;
+    int has_luser_relay = 0;
 
     assert(addr != NULL && msg != NULL);
 
@@ -873,6 +875,13 @@
     }
     *dest = '\0';
        
+    luser_relay = config_getstring(IMAPOPT_LMTP_LUSER_RELAY);
+    if( luser_relay ) {
+      if( !verify_user(luser_relay, NULL, NULL, ignorequota ? -1 : msg->size, 
msg->authstate) ) {
+          has_luser_relay = 1;
+      }
+    }
+
     /* make a working copy of rcpt */
     ret->user = ret->rcpt = xstrdup(rcpt);
 
@@ -898,12 +907,17 @@
     r = verify_user(ret->user, ret->domain, ret->mailbox,
                    ignorequota ? -1 : msg->size, msg->authstate);
     if (r) {
-       /* we lost */
-       free(ret->all);
-       free(ret->rcpt);
-       free(ret);
-       return r;
+       if( r == IMAP_MAILBOX_NONEXISTENT && has_luser_relay ) {
+           ret->user = xstrdup(luser_relay);
+       } else {
+           /* we lost */
+           free(ret->all);
+           free(ret->rcpt);
+           free(ret);
+           return r;
+       }
     }
+
     ret->ignorequota = ignorequota;
 
     msg->rcpt[msg->rcpt_num] = ret;
--- lib/imapoptions
+++ lib/imapoptions     2004/05/31 11:57:52
@@ -837,6 +837,10 @@
    to set this to yes, especially if OpenLDAP is used as authentication
    source. */
 
+{ "lmtp_luser_relay", NULL, STRING }
+/* Send mail to mailboxes, which do not exists, to this user. NOTE: This must
+   be an existing local mailbox name. NOT an email address! */
+
 /*
 .SH SEE ALSO
 .PP

Attachment: pgp49rQA6UonL.pgp
Description: PGP signature

Reply via email to