From 414f6c80b22b128c25d947d62f6b5d1ec13091b6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 31 Jan 2005 01:57:58 +0000 Subject: r5114: the nbtd task can now act as a basic B-node server. It registers its names on the network and answers name queries. Lots of details are still missing, but at least this now means you don't need a Samba3 nmbd to use Samba4. missing pieces include: - name registrations should be "shout 3 times, then demand" - no WINS server yet - no master browser code (This used to be commit d7d31fdc6670f026f96b50e51a4de19f0b920e5b) --- source4/libcli/nbt/namequery.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'source4/libcli/nbt/namequery.c') diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c index 6f549e6241..f6744e9f14 100644 --- a/source4/libcli/nbt/namequery.c +++ b/source4/libcli/nbt/namequery.c @@ -66,7 +66,7 @@ failed: } /* - wait for a name query replu + wait for a name query reply */ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, TALLOC_CTX *mem_ctx, struct nbt_name_query *io) @@ -75,6 +75,7 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, struct nbt_name_packet *packet; const char *addr; struct in_addr in; + int i; status = nbt_name_request_recv(req); if (!NT_STATUS_IS_OK(status) || @@ -94,13 +95,23 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, } io->out.name = packet->answers[0].name; - in.s_addr = htonl(packet->answers[0].rdata.netbios.ipaddr); - addr = inet_ntoa(in); - if (addr == NULL) { + io->out.num_addrs = packet->answers[0].rdata.netbios.length / 6; + io->out.reply_addrs = talloc_array(mem_ctx, const char *, io->out.num_addrs); + if (io->out.reply_addrs == NULL) { talloc_free(req); return NT_STATUS_NO_MEMORY; } - io->out.reply_addr = talloc_strdup(mem_ctx, addr); + + for (i=0;iout.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); + } + talloc_steal(mem_ctx, io->out.name.name); talloc_steal(mem_ctx, io->out.name.scope); @@ -110,7 +121,7 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req, } /* - wait for a name query replu + wait for a name query reply */ NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock, TALLOC_CTX *mem_ctx, struct nbt_name_query *io) @@ -156,7 +167,7 @@ failed: } /* - wait for a name status replu + wait for a name status reply */ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req, TALLOC_CTX *mem_ctx, struct nbt_name_status *io) @@ -199,7 +210,7 @@ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req, } /* - wait for a name status replu + wait for a name status reply */ NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock, TALLOC_CTX *mem_ctx, struct nbt_name_status *io) -- cgit