--- lmtpd.c.orig Mon Jun 3 19:22:26 2002 +++ lmtpd.c Sun Jul 7 18:20:26 2002 @@ -1196,12 +1196,36 @@ for (n = 0; n < nrcpts; n++) { char *rcpt = xstrdup(msg_getrcpt(msgdata, n)); char *plus; + char *at_on; int quotaoverride = msg_getrcpt_ignorequota(msgdata, n); int r = 0; mydata.cur_rcpt = n; - plus = strchr(rcpt, '+'); + if ( (plus = strchr(rcpt, '+')) != NULL ) { + /* simon */ + /* ok so we are going to put plus in its own space + ** and make rcpt = user@domain.com + */ + if ( (at_on = strchr(plus,'@')) != NULL ) { + char *temp; + /* need to alloc some memory for plus */ + temp = (char *) xmalloc(at_on - plus + 1); + memcpy(temp,plus+1,at_on-plus); + temp[at_on-plus-1] = '\0'; + memmove(plus,at_on,strlen(at_on)+1); /* must get the null */ + plus = temp; + + syslog(LOG_ERR, "lmtpd patch : %s %s", plus,rcpt); + } else { + /* just do what would normally happen */ + *plus = '\0'; + } + } + + /* + plus = strchr(rcpt, '+'); if (plus) *plus++ = '\0'; + */ /* case 1: shared mailbox request */ if (plus && !strcmp(rcpt, BB)) { strcpy(namebuf, lmtpd_namespace.prefix[NAMESPACE_SHARED]); @@ -1294,6 +1318,7 @@ } } + if (plus) free(plus); free(rcpt); msg_setrcpt_status(msgdata, n, r); } @@ -1375,6 +1400,7 @@ { char buf[MAX_MAILBOX_NAME]; char *plus; + char *at_on; int r; int sl = strlen(BB); @@ -1382,7 +1408,6 @@ if (!strncmp(user, BB, sl) && user[sl] == '+') { /* special shared folder address */ strcpy(buf, user + sl + 1); - /* Translate any separators in user */ mboxname_hiersep_tointernal(&lmtpd_namespace, buf); /* - must have posting privileges on shared folders - don't care about message size (1 msg over quota allowed) */ @@ -1395,8 +1420,17 @@ } else { strcpy(buf, "user."); strcat(buf, user); - plus = strchr(buf, '+'); - if (plus) *plus = '\0'; + if ( (plus = strchr(buf, '+')) != NULL ) { + /*if (plus) *plus = '\0';*/ + /* turn simon+what@surf.org.uk */ + /* into simon@surf.org.uk */ + /* find @ */ + if ( (at_on = strchr(plus,'@')) != NULL ) { + memmove(plus,at_on,strlen(at_on)+1); /* must get the null */ + } else { + if (plus) *plus = '\0'; + } + } /* Translate any separators in user */ mboxname_hiersep_tointernal(&lmtpd_namespace, buf+5); /* - don't care about ACL on INBOX (always allow post) @@ -1453,14 +1487,21 @@ */ if ((msg_getnumrcpt(msgdata) == 1) || singleinstance) { int r = 0; - char *rcpt, *plus, *user = NULL; + char *rcpt, *plus, *user , *at_on = NULL; char namebuf[MAX_MAILBOX_PATH], mailboxname[MAX_MAILBOX_PATH]; time_t now = time(NULL); /* build the mailboxname from the recipient address */ rcpt = xstrdup(msg_getrcpt(msgdata, 0)); + /* simon */ plus = strchr(rcpt, '+'); - if (plus) *plus++ = '\0'; + if (plus) { + if ( (at_on = strchr(plus,'@')) != NULL ) { + memmove(plus,at_on,strlen(at_on)+1); /* must get the null */ + } else { + *plus = '\0'; + } + } /* case 1: shared mailbox request */ if (plus && !strcmp(rcpt, BB)) { --- lmtpengine.c.orig Thu Jun 6 01:12:34 2002 +++ lmtpengine.c Sun Jul 7 14:29:02 2002 @@ -1138,7 +1138,7 @@ } } else { - while (*addr != '@' && *addr != '>') { + while ( *addr != '>' && &addr != NULL ) { if (*addr == '\\') addr++; *dest++ = *addr++; }