From 20b85c03e751b4876fa3c92040464e483172b746 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 19:03:11 +0200 Subject: manual format adjustment --- src/smtpdlog.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/smtpdlog.c') diff --git a/src/smtpdlog.c b/src/smtpdlog.c index c7505af..6cb0266 100644 --- a/src/smtpdlog.c +++ b/src/smtpdlog.c @@ -8,6 +8,7 @@ #include "exit.h" #include "fmt.h" #include "str.h" + #define FDLOG 2 char *reply421pgl; @@ -43,11 +44,13 @@ static void logs(char *s) { if (buffer_puts(&bo2, s) == -1) _exit(1); } /* single string */ + static void logp(char *s) { logs(" P:"); logs(s); } /* protocol */ + static void logh(char *s1, char *s2, char *s3) { logs(" S:"); @@ -57,27 +60,32 @@ static void logh(char *s1, char *s2, char *s3) logs(" H:"); logs(s3); } /* host */ + static void logm(char *s) { logs(" F:"); logs(s); } /* mailfrom */ + static void logt(char *s) { logs(" T:"); logs(s); } /* rcptto */ + static void logi(char *s) { logs(" '"); logs(s); logs("'"); } /* information */ + static void logn(char *s) { if (buffer_puts(&bo2, s) == -1) _exit(1); if (buffer_flush(&bo2) == -1) _exit(1); } /* end */ + static void logpid() { strnum[fmt_ulong(strnum, getpid())] = 0; @@ -98,6 +106,7 @@ void smtp_loga(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char logi(s8); logn("\n"); } /* Auth info */ + void smtp_logb(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { logpid(); @@ -109,6 +118,7 @@ void smtp_logb(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char logi(s6); logn("\n"); } /* Auth info */ + void smtp_logg(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { logpid(); @@ -119,6 +129,7 @@ void smtp_logg(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char logt(s7); logn("\n"); } /* Generic */ + void smtp_logh(char *s1, char *s2, char *s3, char *s4, char *s5) { logpid(); @@ -127,6 +138,7 @@ void smtp_logh(char *s1, char *s2, char *s3, char *s4, char *s5) logh(s3, s4, s5); logn("\n"); } /* Host */ + void smtp_logi(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8) { logpid(); @@ -138,6 +150,7 @@ void smtp_logi(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char logi(s8); logn("\n"); } /* Generic + Info */ + void smtp_logr(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8) { logpid(); @@ -154,36 +167,42 @@ void die_read() { _exit(1); } + void die_alarm() { out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); } + void die_nomem() { out("421 out of memory (#4.3.0)\r\n"); flush(); _exit(1); } + void die_control() { out("421 unable to read controls (#4.3.0)\r\n"); flush(); _exit(1); } + void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); } + void die_starttls() { out("454 TLS not available due to temporary reason (#5.7.3)\r\n"); flush(); _exit(1); } + void die_recipients() { out("421 unable to check recipients (#4.3.0)\r\n"); @@ -195,18 +214,22 @@ void err_unimpl() { out("500 unimplemented (#5.5.1)\r\n"); } + void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); } + void err_noop() { out("250 ok\r\n"); } + void err_vrfy() { out("252 send some mail, i'll try my best\r\n"); } + void err_qqt() { out("451 qqt failure (#4.3.0)\r\n"); @@ -217,16 +240,19 @@ int err_child() out("454 problem with child and I can't auth (#4.3.0)\r\n"); return -1; } + int err_fork() { out("454 child won't start and I can't auth (#4.3.0)\r\n"); return -1; } + int err_pipe() { out("454 unable to open pipe and I can't auth (#4.3.0)\r\n"); return -1; } + int err_write() { out("454 unable to write pipe and I can't auth (#4.3.0)\r\n"); @@ -238,6 +264,7 @@ int err_postgl() out("454 problem with child and I can't greylist (#4.3.0)\r\n"); return -1; } + int err_forkgl() { out("454 problem with child and I can't greylist (#4.3.0)\r\n"); @@ -251,6 +278,7 @@ int err_starttls() out("454 TLS not available due to temporary reason (#5.7.3)\r\n"); _exit(1); } + void err_tlsreq(char *s1, char *s2, char *s3, char *s4, char *s5) { out("535 STARTTLS required (#5.7.1)\r\n"); @@ -274,44 +302,53 @@ void err_authsetup(char *s1, char *s2, char *s3, char *s4, char *s5) out("530 Auth not available (#5.7.1)\r\n"); smtp_logh(s1, s2, s3, s4, s5); } + void err_authd() { out("503 you're already authenticated (#5.5.0)\r\n"); } + void err_authmail() { out("503 no auth during mail transaction (#5.5.0)\r\n"); } + void err_authfail(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("535 authentication failed (#5.7.1)\r\n"); smtp_logb(s1, s2, s3, s4, s5, s6, s7); } + void err_authreq(char *s1, char *s2, char *s3, char *s4, char *s5) { out("535 authentication required (#5.7.1)\r\n"); smtp_logh(s1, s2, s3, s4, s5); } + void err_submission(char *s1, char *s2, char *s3, char *s4, char *s5) { out("530 Authorization required (#5.7.1) \r\n"); smtp_logh(s1, s2, s3, s4, s5); } + int err_authabort() { out("501 auth exchange canceled (#5.0.0)\r\n"); return -1; } + int err_authinput() { out("501 malformed auth input (#5.5.4)\r\n"); return -1; } + void err_authinvalid(char *s1, char *s2, char *s3, char *s4, char *s5) { out("504 auth type unimplemented (#5.5.1)\r\n"); smtp_logh(s1, s2, s3, s4, s5); } + int err_noauth() { out("504 auth type unimplemented (#5.5.1)\r\n"); @@ -332,6 +369,7 @@ void err_mav(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s out(" (#5.7.1)\r\n"); smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_bmf(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8) { out("553 sorry, your envelope sender is in my badmailfrom list "); @@ -339,6 +377,7 @@ void err_bmf(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s out(" (#5.7.1)\r\n"); smtp_logi(s1, s2, s3, s4, s5, s6, s7, s8); } + void err_mfdns(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("553 sorry, your envelope sender must exist "); @@ -385,6 +424,7 @@ void postgrey(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char * out(" (#4.3.0)\r\n"); smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_nogateway(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("553 sorry, that domain isn't in my list of allowed rcpthosts "); @@ -392,6 +432,7 @@ void err_nogateway(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, c out(" (#5.7.1)\r\n"); smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_brt(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("553 sorry, your envelope recipient is in my badrcptto list "); @@ -399,11 +440,13 @@ void err_brt(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s out(" (#5.7.1)\r\n"); smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_rcpts(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("452 sorry, too many recipients (#4.5.3)\r\n"); /* RFC 5321 */ smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_recipient(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { if (env_get("RECIPIENTS450")) @@ -424,17 +467,20 @@ void straynewline() flush(); _exit(1); } + void err_notorious() { out("503 DATA command not accepted at this time (#5.5.1)\r\n"); flush(); _exit(1); } + void err_size(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7) { out("552 sorry, that message size exceeds my databytes limit (#5.3.4)\r\n"); smtp_logg(s1, s2, s3, s4, s5, s6, s7); } + void err_data(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8) { out("554 sorry, invalid message content "); -- cgit v1.2.3