diff options
Diffstat (limited to 'src/qmail-popup.c')
-rw-r--r-- | src/qmail-popup.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/qmail-popup.c b/src/qmail-popup.c index e94e9a7..c8ee5a4 100644 --- a/src/qmail-popup.c +++ b/src/qmail-popup.c @@ -26,12 +26,12 @@ #define FDAUTH 3 #define FDLOG 5 -void die() +static void die() { _exit(1); } -ssize_t saferead(int fd, char *buf, int len) +static ssize_t saferead(int fd, char *buf, int len) { int r; r = timeoutread(1200, fd, buf, len); @@ -39,7 +39,7 @@ ssize_t saferead(int fd, char *buf, int len) return r; } -ssize_t safewrite(int fd, char *buf, int len) +static ssize_t safewrite(int fd, char *buf, int len) { int r; r = timeoutwrite(1200, fd, buf, len); @@ -53,17 +53,17 @@ buffer bo = BUFFER_INIT(safewrite, FDOUT, outbuf, sizeof(outbuf)); char inbuf[128]; buffer bi = BUFFER_INIT(saferead, FDIN, inbuf, sizeof(inbuf)); -void outs(char *s) +static void outs(char *s) { buffer_puts(&bo, s); } -void flush() +static void flush() { buffer_flush(&bo); } -void err(char *s) +static void err(char *s) { outs("-ERR "); outs(s); @@ -83,18 +83,18 @@ char strnum[FMT_ULONG]; char logbuf[512]; buffer bl = BUFFER_INIT(safewrite, FDLOG, logbuf, sizeof(logbuf)); -void logs(char *s) +static void logs(char *s) { if (buffer_puts(&bl, s) == -1) _exit(1); } -void logp(char *s) +static void logp(char *s) { logs(" P:"); logs(s); } -void logh(char *s1, char *s2) +static void logh(char *s1, char *s2) { logs(" S:"); logs(s1); @@ -102,20 +102,20 @@ void logh(char *s1, char *s2) logs(s2); } -void logu(char *s) +static void logu(char *s) { logs(" ?~ '"); logs(s); logs("'"); } -void logn(char *s) +static void logn(char *s) { if (buffer_puts(&bl, s) == -1) _exit(1); if (buffer_flush(&bl) == -1) _exit(1); } -void logpid() +static void logpid() { strnum[fmt_ulong(strnum, getpid())] = 0; logs("qmail-popup: pid "); @@ -123,7 +123,7 @@ void logpid() logs(" "); } -void log_pop(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) +static void log_pop(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) { logpid(); logs(s1); @@ -132,87 +132,87 @@ void log_pop(char *s1, char *s2, char *s3, char *s4, char *s5, char *s6) logh(s4, s5), logu(s6), logn("\n"); } -void die_usage() +static void die_usage() { err("usage: popup hostname subprogram"); die(); } -void die_nomem() +static void die_nomem() { err("out of memory"); die(); } -void die_pipe() +static void die_pipe() { err("unable to open pipe"); die(); } -void die_write() +static void die_write() { err("unable to write pipe"); die(); } -void die_fork() +static void die_fork() { err("unable to fork"); die(); } -void die_childcrashed() +static void die_childcrashed() { err("aack, child crashed"); } -void die_badauth() +static void die_badauth() { err("authorization failed"); } -void die_tls() +static void die_tls() { err("TLS startup failed"); die(); } -void die_notls() +static void die_notls() { err("TLS required but not negotiated"); log_pop("Reject::STLS::", "Any", "POP3", remoteip, remotehost, "unknown"); die(); } -void err_syntax() +static void err_syntax() { err("syntax error"); } -void err_wantuser() +static void err_wantuser() { err("USER first"); } -void err_authoriz() +static void err_authoriz() { err("authorization first"); } -void okay() +static void okay() { outs("+OK \r\n"); flush(); } -void pop3_quit() +static void pop3_quit() { okay(); die(); } -void poplog_init() +static void poplog_init() { if (!stralloc_copys(&protocol, "POP3")) die_nomem(); localport = env_get("TCP6LOCALPORT"); @@ -240,7 +240,7 @@ int stls = 0; int seenstls = 0; int apop = 0; -void doanddie(char *user, unsigned int userlen, char *pass) /* userlen: including 0 byte */ +static void doanddie(char *user, unsigned int userlen, char *pass) /* userlen: including 0 byte */ { int child; int wstat; @@ -283,7 +283,7 @@ void doanddie(char *user, unsigned int userlen, char *pass) /* userlen: includin die(); } -void pop3_greet() +static void pop3_greet() { char *s; s = unique; @@ -304,7 +304,7 @@ void pop3_greet() flush(); } -void pop3_user(char *arg) +static void pop3_user(char *arg) { if (stls == 2 && !seenstls) die_notls(); if (!*arg) { @@ -317,7 +317,7 @@ void pop3_user(char *arg) if (!stralloc_0(&username)) die_nomem(); } -void pop3_pass(char *arg) +static void pop3_pass(char *arg) { if (!seenuser) { err_wantuser(); @@ -331,7 +331,7 @@ void pop3_pass(char *arg) doanddie(username.s, username.len, arg); } -void pop3_apop(char *arg) +static void pop3_apop(char *arg) { char *space; @@ -346,7 +346,7 @@ void pop3_apop(char *arg) doanddie(arg, space - arg, space); } -void pop3_capa(char *arg) +static void pop3_capa(char *arg) { outs("+OK capability list follows\r\n"); outs("TOP\r\n"); @@ -358,7 +358,7 @@ void pop3_capa(char *arg) flush(); } -void pop3_stls(char *arg) +static void pop3_stls(char *arg) { if (stls == 0 || seenstls == 1) return err("STLS not available"); outs("+OK starting TLS negotiation\r\n"); |