packet->questions[0].question_class = NBT_QCLASS_IP;
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
- timeval_current_ofs(io->in.timeout, 0), False);
+ io->in.timeout, io->in.retries, False);
if (req == NULL) goto failed;
talloc_free(packet);
{
NTSTATUS status;
struct nbt_name_packet *packet;
- const char *addr;
- struct in_addr in;
int i;
status = nbt_name_request_recv(req);
packet = req->replies[0].packet;
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].reply_addr);
+ if ((packet->operation & NBT_RCODE) != 0) {
+ status = nbt_rcode_to_ntstatus(packet->operation & NBT_RCODE);
+ talloc_free(req);
+ return status;
+ }
+
if (packet->ancount != 1 ||
packet->answers[0].rr_type != NBT_QTYPE_NETBIOS ||
packet->answers[0].rr_class != NBT_QCLASS_IP) {
talloc_free(req);
- return NT_STATUS_INVALID_NETWORK_RESPONSE;
+ return status;
}
io->out.name = packet->answers[0].name;
}
for (i=0;i<io->out.num_addrs;i++) {
- in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[i].ipaddr);
- addr = inet_ntoa(in);
- if (addr == NULL) {
- talloc_free(req);
- return NT_STATUS_NO_MEMORY;
- }
- io->out.reply_addrs[i] = talloc_strdup(mem_ctx, addr);
+ io->out.reply_addrs[i] = talloc_steal(mem_ctx,
+ packet->answers[0].rdata.netbios.addresses[i].ipaddr);
}
talloc_steal(mem_ctx, io->out.name.name);
packet->questions[0].question_class = NBT_QCLASS_IP;
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
- timeval_current_ofs(io->in.timeout, 0), False);
+ io->in.timeout, io->in.retries, False);
if (req == NULL) goto failed;
talloc_free(packet);
packet = req->replies[0].packet;
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].reply_addr);
+ if ((packet->operation & NBT_RCODE) != 0) {
+ status = nbt_rcode_to_ntstatus(packet->operation & NBT_RCODE);
+ talloc_free(req);
+ return status;
+ }
+
if (packet->ancount != 1 ||
packet->answers[0].rr_type != NBT_QTYPE_STATUS ||
packet->answers[0].rr_class != NBT_QCLASS_IP) {