summaryrefslogtreecommitdiff
path: root/src/dnsstub/dns_rcrw.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
commit795ffc5e62e8ba383575dbcd9943a580d4bd3358 (patch)
treec128889056202b255e2f22afeb7717894d350862 /src/dnsstub/dns_rcrw.c
parent5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (diff)
formatting changes
Manual format adjustments. Comment adjustments. Remove usage of the register keyword.
Diffstat (limited to 'src/dnsstub/dns_rcrw.c')
-rw-r--r--src/dnsstub/dns_rcrw.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dnsstub/dns_rcrw.c b/src/dnsstub/dns_rcrw.c
index 8c15591..95239a2 100644
--- a/src/dnsstub/dns_rcrw.c
+++ b/src/dnsstub/dns_rcrw.c
@@ -8,10 +8,10 @@
#include "taia.h"
/**
- @file dns_rcrw.c
- @author djb
- @source ucspi-tcp
- @brief DNS receive rewrite
+ @file dns_rcrw.c
+ @author djb
+ @source ucspi-tcp
+ @brief DNS receive rewrite
*/
static stralloc data = {0};
@@ -56,12 +56,13 @@ static int init(stralloc *rules)
if (!stralloc_append(&data, " ")) return DNS_MEM;
if (!stralloc_copys(rules, "?:")) return DNS_MEM;
i = 0;
- for (j = 0; j < data.len; ++j)
+ for (j = 0; j < data.len; ++j) {
if (data.s[j] == ' ') {
if (!stralloc_cats(rules, "+.")) return DNS_MEM;
if (!stralloc_catb(rules, data.s + i, j - i)) return DNS_MEM;
i = j + 1;
}
+ }
if (!stralloc_0(rules)) return DNS_MEM;
if (!stralloc_cats(rules, "*.:")) return DNS_MEM;
if (!stralloc_0(rules)) return DNS_MEM;
@@ -74,7 +75,7 @@ static int init(stralloc *rules)
if (i) {
if (!stralloc_append(&data, "\n")) return DNS_MEM;
i = 0;
- for (j = 0; j < data.len; ++j)
+ for (j = 0; j < data.len; ++j) {
if (data.s[j] == '\n') {
if (byte_equal("search ", 7, data.s + i) || byte_equal("search\t", 7, data.s + i)
|| byte_equal("domain ", 7, data.s + i) || byte_equal("domain\t", 7, data.s + i))
@@ -99,6 +100,7 @@ static int init(stralloc *rules)
}
i = j + 1;
}
+ }
}
host[0] = 0;