24static char strnum[FMT_ULONG];
42static void logs(
char *s) {
if (buffer_puts(&
bo2,s) == -1)
_exit(1); }
43static void logp(
char *s) { logs(
" P:"); logs(s); }
44static void logh(
char *s1,
char *s2,
char *s3) { logs(
" S:"); logs(s1); logs(
":"); logs(s2); logs(
" H:"); logs(s3); }
45static void logm(
char *s) { logs(
" F:"); logs(s); }
46static void logt(
char *s) { logs(
" T:"); logs(s); }
47static void logi(
char *s) { logs(
" '"); logs(s); logs(
"'"); }
48static void logn(
char *s) {
if (buffer_puts(&
bo2,s) == -1 )
_exit(1);
if (buffer_flush(&
bo2) == -1)
_exit(1); }
49static void logpid() {
strnum[fmt_ulong(strnum,getpid())] = 0; logs(
"qmail-smtpd: pid "); logs(strnum); logs(
" "); }
51void smtp_loga(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8,
char *s9)
52 { logpid(); logs(s1); logs(s9); logp(s2); logh(s3,s4,s5); logm(s6); logt(s7), logs(
" ?~"); logi(s8); logn(
"\n"); }
53void smtp_logb(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
54 { logpid(); logs(s1); logs(s7); logp(s2); logh(s3,s4,s5); logs(
" ?~"); logi(s6); logn(
"\n"); }
55void smtp_logg(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
56 { logpid(); logs(s1); logp(s2); logh(s3,s4,s5); logm(s6); logt(s7); logn(
"\n"); }
57void smtp_logh(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5)
58 { logpid(); logs(s1); logp(s2); logh(s3,s4,s5); logn(
"\n"); }
59void smtp_logi(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8)
60 { logpid(); logs(s1); logp(s2); logh(s3,s4,s5); logm(s6); logt(s7); logi(s8); logn(
"\n"); }
61void smtp_logr(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8)
62 { logpid(); logs(s1); logs(s2); logp(s3); logh(s4,s5,s6); logm(s7); logt(s8); logn(
"\n"); }
75void err_vrfy() {
out(
"252 send some mail, i'll try my best\r\n"); }
78int err_child() {
out(
"454 problem with child and I can't auth (#4.3.0)\r\n");
return -1; }
79int err_fork() {
out(
"454 child won't start and I can't auth (#4.3.0)\r\n");
return -1; }
80int err_pipe() {
out(
"454 unable to open pipe and I can't auth (#4.3.0)\r\n");
return -1; }
81int err_write() {
out(
"454 unable to write pipe and I can't auth (#4.3.0)\r\n");
return -1; }
83int err_postgl() {
out(
"454 problem with child and I can't greylist (#4.3.0)\r\n");
return -1; }
84int err_forkgl() {
out(
"454 problem with child and I can't greylist (#4.3.0)\r\n");
return -1; }
90 out(
"454 TLS not available due to temporary reason (#5.7.3)\r\n");
93void err_tlsreq(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5)
95 out(
"535 STARTTLS required (#5.7.1)\r\n");
101void err_helo(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8)
103 out(
"550 sorry, invalid HELO/EHLO greeting ");
105 out(
" (#5.7.1)\r\n");
113 out(
"530 Auth not available (#5.7.1)\r\n");
118 out(
"503 you're already authenticated (#5.5.0)\r\n");
122 out(
"503 no auth during mail transaction (#5.5.0)\r\n");
124void err_authfail(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
126 out(
"535 authentication failed (#5.7.1)\r\n");
smtp_logb(s1,s2,s3,s4,s5,s6,s7);
130 out(
"535 authentication required (#5.7.1)\r\n");
smtp_logh(s1,s2,s3,s4,s5);
134 out(
"530 Authorization required (#5.7.1) \r\n");
smtp_logh(s1,s2,s3,s4,s5);
138 out(
"501 auth exchange canceled (#5.0.0)\r\n");
143 out(
"501 malformed auth input (#5.5.4)\r\n");
148 out(
"504 auth type unimplemented (#5.5.1)\r\n");
153 out(
"504 auth type unimplemented (#5.5.1)\r\n");
161void err_mav(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
163 out(
"553 sorry, invalid sender address specified ");
165 out(
" (#5.7.1)\r\n");
168void err_bmf(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8)
170 out(
"553 sorry, your envelope sender is in my badmailfrom list ");
172 out(
" (#5.7.1)\r\n");
175void err_mfdns(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
177 out(
"553 sorry, your envelope sender must exist ");
179 out(
" (#5.7.1)\r\n");
185void err_spf(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *
msg)
188 int len = str_len(
msg);
190 for (i = 0; i < len; i =
j + 1) {
191 j = byte_chr(
msg + i, len - i,
'\n') + i;
202 out(
" (#5.7.1)\r\n");
211void postgrey(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
213 out(
"421 greylisted");
215 out(
" (#4.3.0)\r\n");
218void err_nogateway(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
220 out(
"553 sorry, that domain isn't in my list of allowed rcpthosts ");
222 out(
" (#5.7.1)\r\n");
225void err_brt(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
227 out(
"553 sorry, your envelope recipient is in my badrcptto list ");
229 out(
" (#5.7.1)\r\n");
232void err_rcpts(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
234 out(
"452 sorry, too many recipients (#4.5.3)\r\n");
237void err_recipient(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
239 if (env_get(
"RECIPIENTS450"))
240 out(
"450 sorry, mailbox currently unavailable (#4.2.1)\r\n");
242 out(
"550 sorry, no mailbox by that name ");
252 out(
"451 Bare Line Feeds (LF) are not accepted in SMTP; CRLF is required according to RFC 2822.\r\n");
258 out(
"503 DATA command not accepted at this time (#5.5.1)\r\n");
262void err_size(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7)
264 out(
"552 sorry, that message size exceeds my databytes limit (#5.3.4)\r\n");
267void err_data(
char *s1,
char *s2,
char *s3,
char *s4,
char *s5,
char *s6,
char *s7,
char *s8)
269 out(
"554 sorry, invalid message content ");
271 out(
" (#5.3.2)\r\n");
void smtp_logh(char *s1, char *s2, char *s3, char *s4, char *s5)
void err_mav(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_recipient(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void smtp_logg(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void postgrey(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_helo(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8)
void err_submission(char *s1, char *s2, char *s3, char *s4, char *s5)
void err_authinvalid(char *s1, char *s2, char *s3, char *s4, char *s5)
void err_authsetup(char *s1, char *s2, char *s3, char *s4, char *s5)
void smtp_logr(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8)
void err_authfail(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_rcpts(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_spf(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *msg)
void err_tlsreq(char *s1, char *s2, char *s3, char *s4, char *s5)
void smtp_loga(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8, char *s9)
void err_bmf(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8)
void err_authreq(char *s1, char *s2, char *s3, char *s4, char *s5)
void smtp_logi(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8)
void err_mfdns(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_size(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_nogateway(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void smtp_logb(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)
void err_data(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8)
void err_brt(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7)