File luser_relay.patch of Package cyrus-imapd
--- 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