summaryrefslogtreecommitdiff
path: root/src/srsreverse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/srsreverse.c')
-rw-r--r--src/srsreverse.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/srsreverse.c b/src/srsreverse.c
index 33d0e5a..6c87fb2 100644
--- a/src/srsreverse.c
+++ b/src/srsreverse.c
@@ -25,6 +25,7 @@ void die_nomem()
{
logmsg(WHO, 111, FATAL, "out of memory");
}
+
void die_control()
{
logmsg(WHO, 110, FATAL, "Unable to read control files");
@@ -40,14 +41,14 @@ struct constmap mapsrsdomains;
stralloc srserror = {0};
stralloc srshost = {0};
-/** @file srsreverse.c
- @brief forwarding bounces with SRS enhanced addresss
- @return 0 on success (forwarded or not)
- -3 SRS error with error output
- 111 no memory / processing error
- 110 control file not readable
+/**
+ @file srsreverse.c
+ @brief forwarding bounces with SRS enhanced addresss
+ @return 0 on success (forwarded or not)
+ -3 SRS error with error output
+ 111 no memory / processing error
+ 110 control file not readable
*/
-
static int srserror_str(int code)
{
if (!stralloc_copys(&srserror, "SRS: ")) die_nomem();
@@ -105,12 +106,13 @@ int main()
}
j = str_len(host);
- for (i = 0; i <= j; ++i)
+ for (i = 0; i <= j; ++i) {
if ((i == 0) || (host[i] == '.')) {
if (!stralloc_copys(&srshost, "")) die_nomem();
if (!stralloc_catb(&srshost, host + i, j - i)) die_nomem();
if ((srsdomaininfo = constmap(&mapvdomains, srshost.s, srshost.len)) != 0) goto SRSDOMAINS;
}
+ }
if (!stralloc_copys(&srshost, host)) die_nomem();
SRSDOMAINS: