diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-31 01:57:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:23 -0500 |
commit | 414f6c80b22b128c25d947d62f6b5d1ec13091b6 (patch) | |
tree | da147a6c2802a7af79b5dfcdf3d3f6508287520e /source4/libcli/nbt/namequery.c | |
parent | 37449657a8d335097b3f3559f8b5bf084b50b85a (diff) | |
download | samba-414f6c80b22b128c25d947d62f6b5d1ec13091b6.tar.gz samba-414f6c80b22b128c25d947d62f6b5d1ec13091b6.tar.bz2 samba-414f6c80b22b128c25d947d62f6b5d1ec13091b6.zip |
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)
Diffstat (limited to 'source4/libcli/nbt/namequery.c')
-rw-r--r-- | source4/libcli/nbt/namequery.c | 27 |
1 files changed, 19 insertions, 8 deletions
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;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); + } + 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) |