aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2016-08-29 08:16:25 +0200
committerMichael Adam <obnox@samba.org>2016-08-29 08:17:06 +0200
commitbdd11668974c16a011f2dfaefe0aa233c3be1f82 (patch)
treee25466ea99dd74ed2b0b4a71296fb75ee14c42cd
parent02535da4b92bfafbd671cb52c3a86d38572b2066 (diff)
downloadresolv_wrapper-bdd11668974c16a011f2dfaefe0aa233c3be1f82.tar.gz
resolv_wrapper-bdd11668974c16a011f2dfaefe0aa233c3be1f82.tar.xz
resolv_wrapper-bdd11668974c16a011f2dfaefe0aa233c3be1f82.zip
rwrap: improve debug error messages
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--src/resolv_wrapper.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/resolv_wrapper.c b/src/resolv_wrapper.c
index a07086a..a262561 100644
--- a/src/resolv_wrapper.c
+++ b/src/resolv_wrapper.c
@@ -486,9 +486,8 @@ static ssize_t rwrap_fake_a(struct rwrap_fake_rr *rr,
uint8_t *a = answer_ptr;
ssize_t resp_size;
- if (rr == NULL || rr->type != ns_t_a) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_a) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding A RR");
@@ -511,9 +510,8 @@ static ssize_t rwrap_fake_aaaa(struct rwrap_fake_rr *rr,
uint8_t *a = answer;
ssize_t resp_size;
- if (rr == NULL || rr->type != ns_t_aaaa) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_aaaa) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding AAAA RR");
@@ -539,9 +537,8 @@ static ssize_t rwrap_fake_ns(struct rwrap_fake_rr *rr,
unsigned char hostname_compressed[MAXDNAME];
ssize_t compressed_len;
- if (rr == NULL || rr->type != ns_t_ns) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_ns) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding NS RR");
@@ -580,9 +577,8 @@ static ssize_t rwrap_fake_srv(struct rwrap_fake_rr *rr,
unsigned char hostname_compressed[MAXDNAME];
ssize_t compressed_len;
- if (rr == NULL || rr->type != ns_t_srv) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_srv) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding SRV RR");
@@ -621,9 +617,8 @@ static ssize_t rwrap_fake_uri(struct rwrap_fake_rr *rr,
unsigned char uri_compressed[MAXDNAME];
ssize_t compressed_len;
- if (rr == NULL || rr->type != ns_t_uri) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_uri) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding URI RR");
@@ -663,9 +658,8 @@ static ssize_t rwrap_fake_soa(struct rwrap_fake_rr *rr,
unsigned char mailbox_compressed[MAXDNAME];
ssize_t compressed_mb_len;
- if (rr == NULL || rr->type != ns_t_soa) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_soa) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding SOA RR");
@@ -715,9 +709,8 @@ static ssize_t rwrap_fake_cname(struct rwrap_fake_rr *rr,
unsigned char hostname_compressed[MAXDNAME];
ssize_t rdata_size;
- if (rr == NULL || rr->type != ns_t_cname) {
- RWRAP_LOG(RWRAP_LOG_ERROR,
- "Malformed record, no or wrong value!\n");
+ if (rr->type != ns_t_cname) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Wrong type!\n");
return -1;
}
RWRAP_LOG(RWRAP_LOG_TRACE, "Adding CNAME RR");
@@ -980,6 +973,11 @@ static ssize_t rwrap_add_rr(struct rwrap_fake_rr *rr,
{
ssize_t resp_data;
+ if (rr == NULL) {
+ RWRAP_LOG(RWRAP_LOG_ERROR, "Internal error!\n");
+ return -1;
+ }
+
switch (rr->type) {
case ns_t_a:
resp_data = rwrap_fake_a(rr, answer, anslen);