commit bc76cc72218ad3ecbc3caaede9688a5fa4d4d535
parent 6f7024a6c31f36d306a02de9804cb9d93cd67a7c
Author: Ellenor Bjornsdottir <ellenor@umbrellix.net>
Date: Sat, 15 Oct 2022 11:07:04 +0000
it truly sucks. I am sorry I brought this into the world. Let me get done strip mining it for what it's actually worth.
Diffstat:
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/mxf-remote/mxf-remote.c b/src/mxf-remote/mxf-remote.c
@@ -509,10 +509,10 @@ int ipisme (const ipmx_t *ip) {
struct ip6_address i6;
if (ix->is6) {
memcpy(&(i6.d), &(ix->ip), 16);
- return ip6me_is(i6);
+ return ip6me_is(&i6);
} else {
memcpy(&(i4.d), &(ix->ip), 4);
- return ipme_is(i4);
+ return ipme_is(&i4);
}
}
@@ -647,6 +647,7 @@ int dns_havesrv (skadns_t *dnsres, dnsq_t *dnsq, void* protop, void* unused)
tain shortdl;
const char *dnsresponse; char ds[256]; int dnsresplen = 0, dsl = 0, i = 0;
s6dns_message_header_t dnsmh;
+ s6dns_domain_t dnsdfp; // DNS domain of form packet
s6dns_message_rr_srv_t *rr = NULL;
uint16_t qid4, qid6;
@@ -693,11 +694,12 @@ int dns_havesrv (skadns_t *dnsres, dnsq_t *dnsq, void* protop, void* unused)
if (!tain_addsec(&Limit, &Stamp, Timeoutconnect)) temp_wtf("tain_addsec in dns_havesrv (Doctor?)");
if (!tain_addsec(&shortdl, &Stamp, Timeoutconnect)) temp_wtf("tain_addsec in dns_havesrv (Doctor?)");
if (!mxralloc_catmxr(mxres, mxr)) temp_nomem();
+ if (!s6dns_domain_fromstring_noqualify_encode(&dnsdfp, ds, dsl)) temp_wtf("s6dns_domain_fromstring_noqualify_encode in dns_havesrv");
if (mxr.name.len > 1) { // No point if it's just a dot
- if (!skadns_send(&Dnsres, &qid4, &(rr->target), S6DNS_T_A, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havesrv");
- if (!dnsq_add(qid4, &(mxres->mxr[(mxres->len)-1]), proto, dns_havea)) temp_wtf("dnsq_add in dns_havesrv");
- if (!skadns_send(&Dnsres, &qid6, &(rr->target), S6DNS_T_AAAA, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havesrv");
+ if (!skadns_send(&Dnsres, &qid6, &(dnsdfp), S6DNS_T_AAAA, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havesrv");
if (!dnsq_add(qid6, &(mxres->mxr[(mxres->len)-1]), proto, dns_haveaaaa)) temp_wtf("dnsq_add in dns_havesrv");
+ if (!skadns_send(&Dnsres, &qid4, &(dnsdfp), S6DNS_T_A, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havesrv");
+ if (!dnsq_add(qid4, &(mxres->mxr[(mxres->len)-1]), proto, dns_havea)) temp_wtf("dnsq_add in dns_havesrv");
}
memset(&mxr, 0, sizeof(mxresult_t));
}
@@ -715,6 +717,7 @@ int dns_havemx (skadns_t *dnsres, dnsq_t *dnsq, void* protop, void* unused)
genalloc rrs = GENALLOC_ZERO;
tain shortdl;
char const *dnsresponse; char ds[256]; int dnsresplen = 0, dsl = 0, i = 0;
+ s6dns_domain_t dnsdfp;
s6dns_message_header_t dnsmh;
s6dns_message_rr_mx_t *rr = NULL;
uint16_t qid4, qid6;
@@ -768,13 +771,15 @@ int dns_havemx (skadns_t *dnsres, dnsq_t *dnsq, void* protop, void* unused)
if (!tain_addsec(&Limit, &Stamp, Timeoutconnect)) temp_wtf("tain_addsec in dns_havemx (Doctor?)");
if (!tain_addsec(&shortdl, &Stamp, Timeoutconnect)) temp_wtf("tain_addsec in dns_havemx (Doctor?)");
if (!mxralloc_catmxr(mxres, mxr)) temp_nomem();
+ if (!s6dns_domain_fromstring_noqualify_encode(&dnsdfp, ds, dsl)) temp_wtf("s6dns_domain_fromstring_noqualify_encode in dns_havemx");
if (mxr.name.len > 1) { // No point if it's just a dot, NPI.
- if (!skadns_send(&Dnsres, &qid4, &(rr->exchange), S6DNS_T_A, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havemx");
+ if (!skadns_send(&Dnsres, &qid4, &(dnsdfp), S6DNS_T_A, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havemx");
if (!dnsq_add(qid4, &(mxres->mxr[(mxres->len)-1]), proto, dns_havea)) temp_wtf("dnsq_add in dns_havemx");
- if (!skadns_send(&Dnsres, &qid6, &(rr->exchange), S6DNS_T_AAAA, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havemx");
+ if (!skadns_send(&Dnsres, &qid6, &(dnsdfp), S6DNS_T_AAAA, &Limit, &shortdl, &Stamp)) temp_wtf("skadns_send in dns_havemx");
if (!dnsq_add(qid6, &(mxres->mxr[(mxres->len)-1]), proto, dns_haveaaaa)) temp_wtf("dnsq_add in dns_havemx");
}
memset(&mxr, 0, sizeof(mxresult_t));
+ memset(&dnsdfp, 0, sizeof(s6dns_domain_t));
mxr.ismx = TRUE;
}
break;
@@ -883,6 +888,7 @@ int dns_wantip (protocol_t *proto, uint16_t port, char *relayhost)
if (!dnsq_add(qid6, &(mxres->mxr[(mxres->len)-1]), NULL, dns_haveaaaa)) temp_wtf("dnsq_add in dns_wantip");
if (!skadns_send(&Dnsres, &qid4, &dnsdomain, S6DNS_T_A, &Limit, &Deadline, &Stamp)) temp_wtf("skadns_send in dns_wantip");
if (!dnsq_add(qid4, &(mxres->mxr[(mxres->len)-1]), NULL, dns_havea)) temp_wtf("dnsq_add in dns_wantip");
+ //memset(&dnsdfp, 0, sizeof(s6dns_domain_t)); // not necessary?
stralloc_free(&domain);
return TRUE; // not used
}