diff options
| author | manuel <manuel@mausz.at> | 2013-02-05 23:48:16 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-05 23:48:16 +0100 |
| commit | b0c5a1bf27516611d34b6b7d56a0376e3c64171b (patch) | |
| tree | 775492f51e62ed7b0dfe1eba75bfd189950c470f /qmail-smtpd.c | |
| parent | e52f8862b7bd6519055296a9b757259c0fd358d7 (diff) | |
| download | qmail-b0c5a1bf27516611d34b6b7d56a0376e3c64171b.tar.gz qmail-b0c5a1bf27516611d34b6b7d56a0376e3c64171b.tar.bz2 qmail-b0c5a1bf27516611d34b6b7d56a0376e3c64171b.zip | |
[PATCH] realrcptto
Diffstat (limited to 'qmail-smtpd.c')
| -rw-r--r-- | qmail-smtpd.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c index 33ca503..9fb495b 100644 --- a/qmail-smtpd.c +++ b/qmail-smtpd.c | |||
| @@ -116,6 +116,18 @@ void die_ipme() | |||
| 116 | out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); | 116 | out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); |
| 117 | eflush(); _exit(1); | 117 | eflush(); _exit(1); |
| 118 | } | 118 | } |
| 119 | void die_cdb() | ||
| 120 | { | ||
| 121 | enew(); eout("Unable to read cdb user database!\n"); | ||
| 122 | out("421 unable to read cdb user database (#4.3.0)\r\n"); flush(); | ||
| 123 | eflush(); _exit(1); | ||
| 124 | } | ||
| 125 | void die_sys() | ||
| 126 | { | ||
| 127 | enew(); eout("Unable to read system user database!\n"); | ||
| 128 | out("421 unable to read system user database (#4.3.0)\r\n"); flush(); | ||
| 129 | eflush(); _exit(1); | ||
| 130 | } | ||
| 119 | void straynewline() | 131 | void straynewline() |
| 120 | { | 132 | { |
| 121 | enew(); eout("Stray newline from "); eout(remoteip); eout(".\n"); | 133 | enew(); eout("Stray newline from "); eout(remoteip); eout(".\n"); |
| @@ -162,6 +174,13 @@ int err_input() { out("501 malformed auth input (#5.5.4)\r\n"); return -1; } | |||
| 162 | int err_wantstarttls() { out("530 Must issue a STARTTLS command first (#5.7.0)\r\n"); return -1; }; | 174 | int err_wantstarttls() { out("530 Must issue a STARTTLS command first (#5.7.0)\r\n"); return -1; }; |
| 163 | void err_authfail() { out("535 authentication failed (#5.7.1)\r\n"); } | 175 | void err_authfail() { out("535 authentication failed (#5.7.1)\r\n"); } |
| 164 | 176 | ||
| 177 | extern void realrcptto_init(); | ||
| 178 | extern void realrcptto_start(); | ||
| 179 | extern int realrcptto(); | ||
| 180 | extern int realrcptto_deny(); | ||
| 181 | |||
| 182 | int flagauth = 0; | ||
| 183 | |||
| 165 | stralloc greeting = {0}; | 184 | stralloc greeting = {0}; |
| 166 | 185 | ||
| 167 | void smtp_greet(code) char *code; | 186 | void smtp_greet(code) char *code; |
| @@ -260,6 +279,7 @@ void setup() | |||
| 260 | if (fdmbrt == -1) if (errno != error_noent) die_control(); | 279 | if (fdmbrt == -1) if (errno != error_noent) die_control(); |
| 261 | 280 | ||
| 262 | 281 | ||
| 282 | realrcptto_init(); | ||
| 263 | 283 | ||
| 264 | if (control_readint(&databytes,"control/databytes") == -1) die_control(); | 284 | if (control_readint(&databytes,"control/databytes") == -1) die_control(); |
| 265 | x = env_get("DATABYTES"); | 285 | x = env_get("DATABYTES"); |
| @@ -604,6 +624,7 @@ void smtp_mail(arg) char *arg; | |||
| 604 | if (!stralloc_copys(&rcptto,"")) die_nomem(); | 624 | if (!stralloc_copys(&rcptto,"")) die_nomem(); |
| 605 | if (!stralloc_copys(&mailfrom,addr.s)) die_nomem(); | 625 | if (!stralloc_copys(&mailfrom,addr.s)) die_nomem(); |
| 606 | if (!stralloc_0(&mailfrom)) die_nomem(); | 626 | if (!stralloc_0(&mailfrom)) die_nomem(); |
| 627 | realrcptto_start(); | ||
| 607 | recipcount = 0; | 628 | recipcount = 0; |
| 608 | out("250 ok\r\n"); | 629 | out("250 ok\r\n"); |
| 609 | } | 630 | } |
| @@ -653,6 +674,10 @@ void smtp_rcpt(arg) char *arg; { | |||
| 653 | flagbrt = 1; | 674 | flagbrt = 1; |
| 654 | log_deny("BAD RCPT TO", mailfrom.s,addr.s); | 675 | log_deny("BAD RCPT TO", mailfrom.s,addr.s); |
| 655 | } | 676 | } |
| 677 | if (!flagauth && !relayclient && !realrcptto(addr.s,1)) { | ||
| 678 | out("554 sorry, no mailbox here by that name. (#5.1.1)\r\n"); | ||
| 679 | return; | ||
| 680 | } | ||
| 656 | if (!(spp_val = spp_rcpt(allowed))) return; | 681 | if (!(spp_val = spp_rcpt(allowed))) return; |
| 657 | if (!relayclient && spp_val == 1) { | 682 | if (!relayclient && spp_val == 1) { |
| 658 | if (!allowed) { | 683 | if (!allowed) { |
| @@ -785,6 +810,7 @@ void smtp_data() { | |||
| 785 | if (mailfrom.len == 1 && recipcount > 1) { err_badbounce(); return; } | 810 | if (mailfrom.len == 1 && recipcount > 1) { err_badbounce(); return; } |
| 786 | if (flagbrt) { err_brt(); return; } | 811 | if (flagbrt) { err_brt(); return; } |
| 787 | if (!spp_data()) return; | 812 | if (!spp_data()) return; |
| 813 | if (!relayclient && realrcptto_deny()) { out("550 sorry, no mailbox here by that name. (#5.1.1)\r\n"); return; } | ||
| 788 | seenmail = 0; | 814 | seenmail = 0; |
| 789 | if (databytes) bytestooverflow = databytes + 1; | 815 | if (databytes) bytestooverflow = databytes + 1; |
| 790 | if (qmail_open(&qqt) == -1) { err_qqt(); return; } | 816 | if (qmail_open(&qqt) == -1) { err_qqt(); return; } |
| @@ -821,7 +847,6 @@ static stralloc chal = {0}; /* plain challenge */ | |||
| 821 | static stralloc slop = {0}; /* b64 challenge */ | 847 | static stralloc slop = {0}; /* b64 challenge */ |
| 822 | #endif | 848 | #endif |
| 823 | 849 | ||
| 824 | int flagauth = 0; | ||
| 825 | char **childargs; | 850 | char **childargs; |
| 826 | char ssauthbuf[512]; | 851 | char ssauthbuf[512]; |
| 827 | substdio ssauth = SUBSTDIO_FDBUF(safewrite,3,ssauthbuf,sizeof(ssauthbuf)); | 852 | substdio ssauth = SUBSTDIO_FDBUF(safewrite,3,ssauthbuf,sizeof(ssauthbuf)); |
