Skip to content

Commit

Permalink
rs: goodbye char *name!
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Feb 25, 2022
1 parent fe36ff6 commit 6958bfd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,15 @@ hsk_rs_onrecv(
goto fail;
}

// Unbound's name resolution API expects a single null-terminated string.
// Since 0x00 is a valid byte mid-label in wire format we need to
// convert `req->name` to presentation format (i.e. "\000" for 0x00)
if (!hsk_dns_name_to_string(req->name, req->namestr))
goto fail;

rc = hsk_rs_worker_resolve(
ns->rs_worker,
req->name,
req->namestr,
req->type,
req->class,
(void *)req,
Expand Down Expand Up @@ -426,7 +432,9 @@ hsk_rs_respond(
goto fail;
}

hsk_rs_log(ns, "received answer for: %s\n", req->name);
char namestr[HSK_DNS_MAX_NAME_STRING] = {0};
assert(hsk_dns_name_to_string(req->name, namestr));
hsk_rs_log(ns, "received answer for: %s\n", namestr);

if (result->canonname)
hsk_rs_log(ns, " canonname: %s\n", result->canonname);
Expand Down

0 comments on commit 6958bfd

Please sign in to comment.