authd: fix some DNS module logic

This commit is contained in:
William Pitcock 2016-01-08 05:32:27 -06:00
parent 5164a68650
commit fa43f55940

View file

@ -116,16 +116,14 @@ resolve_dns(int parc, char *parv[])
{ {
case '4': case '4':
type = T_A; type = T_A;
if(!rb_inet_pton_sock(rec, (struct sockaddr *) &req->addr))
exit(6);
break; break;
case '6': case '6':
type = T_AAAA; type = T_AAAA;
if(!rb_inet_pton_sock(rec, (struct sockaddr *) &req->addr))
exit(6);
break; break;
case 'R': case 'R':
case 'S': case 'S':
if(!rb_inet_pton_sock(rec, (struct sockaddr *) &req->addr))
exit(6);
type = T_PTR; type = T_PTR;
break; break;
} }
@ -133,5 +131,8 @@ resolve_dns(int parc, char *parv[])
req->query.ptr = req; req->query.ptr = req;
req->query.callback = submit_dns_answer; req->query.callback = submit_dns_answer;
if (type != T_PTR)
gethost_byname_type(rec, &req->query, type); gethost_byname_type(rec, &req->query, type);
else
gethost_byaddr(&req->addr, &req->query);
} }