r5116: fixed build of the nbtlist code
authorAndrew Tridgell <tridge@samba.org>
Mon, 31 Jan 2005 02:50:49 +0000 (02:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:24 +0000 (13:09 -0500)
(This used to be commit 506e1e823cd3f652a793db9f4c43147d298b9b8b)

source4/libcli/resolve/nbtlist.c

index 036e983fd2186bc0f24107e01d143d02c680c30b..08dc90c39d69510c027bfbbb7c6ab1bc4f7f72e6 100644 (file)
@@ -62,8 +62,13 @@ static void nbtlist_handler(struct nbt_name_request *req)
        if (!NT_STATUS_IS_OK(c->status)) {
                c->state = SMBCLI_REQUEST_ERROR;
        } else {
-               c->state = SMBCLI_REQUEST_DONE;
-               state->reply_addr = talloc_steal(state, state->io_queries[i].out.reply_addr);
+               if (state->io_queries[i].out.num_addrs < 1) {
+                       c->state = SMBCLI_REQUEST_ERROR;
+                       c->status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+               } else {
+                       c->state = SMBCLI_REQUEST_DONE;
+                       state->reply_addr = talloc_steal(state, state->io_queries[i].out.reply_addrs[0]);
+               }
        }
 
 done: