diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 19:03:11 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 19:03:11 +0200 |
commit | 20b85c03e751b4876fa3c92040464e483172b746 (patch) | |
tree | 734fadbfdbc143ec4465093857f4c239448715e0 /src/qmail-popup.c | |
parent | a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (diff) |
manual format adjustment
Diffstat (limited to 'src/qmail-popup.c')
-rw-r--r-- | src/qmail-popup.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/qmail-popup.c b/src/qmail-popup.c index 832a56f..e94e9a7 100644 --- a/src/qmail-popup.c +++ b/src/qmail-popup.c @@ -20,10 +20,11 @@ #include "tls_start.h" #define PORT_POP3S "995" -#define FDIN 0 -#define FDOUT 1 -#define FDAUTH 3 -#define FDLOG 5 + +#define FDIN 0 +#define FDOUT 1 +#define FDAUTH 3 +#define FDLOG 5 void die() { @@ -56,10 +57,12 @@ void outs(char *s) { buffer_puts(&bo, s); } + void flush() { buffer_flush(&bo); } + void err(char *s) { outs("-ERR "); @@ -84,11 +87,13 @@ void logs(char *s) { if (buffer_puts(&bl, s) == -1) _exit(1); } + void logp(char *s) { logs(" P:"); logs(s); } + void logh(char *s1, char *s2) { logs(" S:"); @@ -96,17 +101,20 @@ void logh(char *s1, char *s2) logs(":"); logs(s2); } + void logu(char *s) { logs(" ?~ '"); logs(s); logs("'"); } + void logn(char *s) { if (buffer_puts(&bl, s) == -1) _exit(1); if (buffer_flush(&bl) == -1) _exit(1); } + void logpid() { strnum[fmt_ulong(strnum, getpid())] = 0; @@ -114,6 +122,7 @@ void logpid() logs(strnum); logs(" "); } + void log_pop(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) { logpid(); @@ -128,39 +137,47 @@ void die_usage() err("usage: popup hostname subprogram"); die(); } + void die_nomem() { err("out of memory"); die(); } + void die_pipe() { err("unable to open pipe"); die(); } + void die_write() { err("unable to write pipe"); die(); } + void die_fork() { err("unable to fork"); die(); } + void die_childcrashed() { err("aack, child crashed"); } + void die_badauth() { err("authorization failed"); } + void die_tls() { err("TLS startup failed"); die(); } + void die_notls() { err("TLS required but not negotiated"); @@ -172,10 +189,12 @@ void err_syntax() { err("syntax error"); } + void err_wantuser() { err("USER first"); } + void err_authoriz() { err("authorization first"); @@ -186,6 +205,7 @@ void okay() outs("+OK \r\n"); flush(); } + void pop3_quit() { okay(); @@ -257,8 +277,9 @@ void doanddie(char *user, unsigned int userlen, char *pass) /* userlen: includin if (wait_exitcode(wstat)) { die_badauth(); log_pop("Reject::AUTH::", auth.s, protocol.s, remoteip, remotehost, user); - } else + } else { log_pop("Accept::AUTH::", auth.s, protocol.s, remoteip, remotehost, user); + } die(); } @@ -272,9 +293,9 @@ void pop3_greet() *s++ = '@'; *s++ = 0; - if (!apop) + if (!apop) { outs("+OK\r\n"); - else { + } else { outs("+OK <"); outs(unique); outs(hostname); |