aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmail-remote/smtproutes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmail-remote/smtproutes.c')
-rw-r--r--src/qmail-remote/smtproutes.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/qmail-remote/smtproutes.c b/src/qmail-remote/smtproutes.c
index 7467031..987961c 100644
--- a/src/qmail-remote/smtproutes.c
+++ b/src/qmail-remote/smtproutes.c
@@ -96,7 +96,7 @@ static inline char getnext (buffer *b)
{
char c ;
ssize_t r = buffer_get(b, &c, 1) ;
- if (r == -1) qmailr_tempsys("Unable to read from control/smtproutes") ;
+ if (r == -1) qmailr_tempusys("read ", "control/smtproutes") ;
return r ? c : 0 ;
}
@@ -121,7 +121,7 @@ static inline void smtproutes_compile (int fdr, int fdw)
buffer b = BUFFER_INIT(&buffer_read, fdr, buf, 2048) ;
uint32_t relaypos = 0, relayend = 0 ;
uint8_t state = 0 ;
- if (!cdbmake_start(&cm, fdw)) qmailr_tempsys("Unable to cdbmake_start") ;
+ if (!cdbmake_start(&cm, fdw)) qmailr_tempusys("cdbmake_start") ;
while (state < 0x0a)
{
@@ -130,36 +130,36 @@ static inline void smtproutes_compile (int fdr, int fdw)
state = val & 0x000f ;
if (val & 0x0100)
{
- if (!stralloc_catb(&sa, &c, 1)) qmailr_tempsys("Unable to grow stralloc") ;
+ if (!stralloc_catb(&sa, &c, 1)) dienomem() ;
}
if (val & 0x0200)
{
relaypos = sa.len + 1 ;
- if (!stralloc_catb(&sa, "\0\0\31", 3)) qmailr_tempsys("Unable to grow stralloc") ;
+ if (!stralloc_catb(&sa, "\0\0\31", 3)) dienomem() ;
}
if (val & 0x0400)
{
- if (!stralloc_0(&sa)) qmailr_tempsys("Unable to grow stralloc") ;
+ if (!stralloc_0(&sa)) dienomem() ;
relayend = sa.len ;
}
if (val & 0x0800)
{
uint16_t port ;
- if (!stralloc_0(&sa)) qmailr_tempsys("Unable to grow stralloc") ;
- if (!uint160_scan(sa.s + relayend, &port)) qmailr_temp("Invalid port in control/smtproutes") ;
+ if (!stralloc_0(&sa)) dienomem() ;
+ if (!uint160_scan(sa.s + relayend, &port)) qmailr_temp("Invalid port in ", "control/smtproutes") ;
uint16_pack_big(sa.s + relaypos, port) ;
}
if (val & 0x0100)
{
if (relaypos > 1 || relayend > 2 + relaypos)
if (!cdbmake_add(&cm, sa.s, relaypos, sa.s + relaypos, relayend - relaypos))
- qmailr_tempsys("Unable to cdbmake_add") ;
+ qmailr_tempusys("cdbmake_add") ;
sa.len = 0 ;
}
}
- if (state != 0x0a) qmailr_temp("Syntax error in control/smtproutes") ;
+ if (state != 0x0a) qmailr_temp("Syntax error in ", "control/smtproutes") ;
stralloc_free(&sa) ;
- if (!cdbmake_finish(&cm)) qmailr_tempsys("Unable to cdbmake_finish") ;
+ if (!cdbmake_finish(&cm)) qmailr_tempusys("cdbmake_finish") ;
}
int smtproutes_init (smtproutes *routes)
@@ -169,17 +169,17 @@ int smtproutes_init (smtproutes *routes)
static char const *txtfile = SMTPD_STARTTLS_PROXY_QMAIL_HOME "/control/smtproutes" ;
static size_t const cdblen = sizeof(cdbfile) - 1 ;
int fdl = openc_create(lckfile) ;
- if (fdl == -1) qmailr_tempsys("Unable to open run/qmail-remote/smtproutes.lock") ;
- if (fd_lock(fdl, 1, 0) == -1) qmailr_tempsys("Unable to lock run/qmail-remote/smtproutes.lock") ;
+ if (fdl == -1) qmailr_tempusys("open ", "run/qmail-remote/smtproutes.lock") ;
+ if (fd_lock(fdl, 1, 0) == -1) qmailr_tempusys("lock ", "run/qmail-remote/smtproutes.lock") ;
int fdc = openc_read(cdbfile) ;
if (fdc >= 0)
{
struct stat stc, str ;
- if (fstat(fdc, &stc) == -1) qmailr_tempsys("Unable to fstat run/qmail-remote/smtproutes.cdb") ;
+ if (fstat(fdc, &stc) == -1) qmailr_tempusys("fstat ", "run/qmail-remote/smtproutes.cdb") ;
if (stat(txtfile, &str) == -1)
{
- if (errno != ENOENT) qmailr_tempsys("Unable to fstat control/smtproutes") ;
+ if (errno != ENOENT) qmailr_tempusys("fstat ", "control/smtproutes") ;
unlink_void(cdbfile) ;
fd_close(fdc) ;
goto zero ;
@@ -191,7 +191,7 @@ int smtproutes_init (smtproutes *routes)
int fdr = openc_read(txtfile) ;
if (fdr == -1)
{
- if (errno != ENOENT) qmailr_tempsys("Unable to open control/smtproutes") ;
+ if (errno != ENOENT) qmailr_tempusys("open ", "control/smtproutes") ;
goto zero ;
}
@@ -200,16 +200,16 @@ int smtproutes_init (smtproutes *routes)
memcpy(tmp, cdbfile, cdblen) ;
memcpy(tmp + cdblen, ":XXXXXX", 8) ;
fdc = mkstemp(tmp) ;
- if (fdc == -1) qmailr_tempsys("Unable to mkstemp") ;
+ if (fdc == -1) qmailr_tempusys("mkstemp") ;
smtproutes_compile(fdr, fdc) ;
- if (lseek(fdc, 0, SEEK_SET) == -1) qmailr_tempsys("Unable to lseek") ;
- if (fsync(fdc) == -1) qmailr_tempsys("Unable to fsync run/qmail-remote/smtproutes.cdb") ;
+ if (lseek(fdc, 0, SEEK_SET) == -1) qmailr_tempusys("lseek") ;
+ if (fsync(fdc) == -1) qmailr_tempusys("fsync ", "run/qmail-remote/smtproutes.cdb") ;
fd_close(fdr) ;
if (rename(tmp, cdbfile) == -1) unlink_void(tmp) ;
}
useit:
- if (!cdb_init_fromfd(&routes->map, fdc)) qmailr_tempsys("Unable to mmap run/qmail-remote/smtproutes.cdb") ;
+ if (!cdb_init_fromfd(&routes->map, fdc)) qmailr_tempusys("mmap ", "run/qmail-remote/smtproutes.cdb") ;
fd_close(fdc) ;
fd_close(fdl) ;
return 1 ;
@@ -227,10 +227,10 @@ int smtproutes_match (smtproutes const *routes, char const *s, stralloc *sa, siz
if (r == -1) qmailr_temp("Invalid run/qmail-remote/smtproutes.cdb") ;
if (!r) return 0 ;
if (data.len < 3) return 0 ;
- if (data.s[data.len - 1]) qmailr_temp("Invalid run/qmail-remote/smtproutes.cdb") ;
+ if (data.s[data.len - 1]) qmailr_temp("Invalid ", "run/qmail-remote/smtproutes.cdb") ;
*pos = sa->len ;
uint16_unpack_big(data.s, port) ;
- if (!stralloc_catb(sa, data.s + 2, data.len - 2)) qmailr_tempsys("Unable to grow stralloc") ;
+ if (!stralloc_catb(sa, data.s + 2, data.len - 2)) dienomem() ;
return 1 ;
}