--- qmail-smtpd.c-ooo Mon Jun 15 19:53:16 1998 +++ qmail-smtpd.c Thu Dec 6 22:43:01 2001 @@ -51,6 +51,7 @@ void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); } void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); } +void err_srcrouting() { out("553 sorry, soure routing not allowed.\r\n"); } void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); } void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); } void err_wantmail() { out("503 MAIL first (#5.5.1)\r\n"); } @@ -247,8 +248,25 @@ if (!stralloc_0(&mailfrom)) die_nomem(); out("250 ok\r\n"); } +int smtp_src_rtg (arg) char *arg;{ + int r,l,c,p,b; + char* pt; + r = (int) str_rchr(arg,'@'); + l = (int) str_len(arg); + c = (int) str_chr(arg,'@'); + p = (int) str_chr(arg,'%'); + b = (int) str_chr(arg,'!'); + if (l != p ) return 0; // % not totally allowed. + if (l != r && c != r ) return 0; // @ appears twice + if (l != b ) return 0; // bang ! not totally allowed. + // pt = (char*) strrchr(arg,'@'); + // *pt++ = '>'; + // *pt = 0; + return 1; +} void smtp_rcpt(arg) char *arg; { if (!seenmail) { err_wantmail(); return; } + if (!smtp_src_rtg (arg)) { err_srcrouting() ;return;} if (!addrparse(arg)) { err_syntax(); return; } if (flagbarf) { err_bmf(); return; } if (relayclient) {