summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-29 16:58:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:48:56 -0500
commit8faa1f4f9af114985b0c6b7383f0f1c935e83f9f (patch)
tree1f4af8c4daf46b16d4b7a298474b639b564e1857 /source4/nbt_server
parent87fd7b5484b10ccdece6152f2a2a9adb4ea5fc78 (diff)
downloadsamba-8faa1f4f9af114985b0c6b7383f0f1c935e83f9f.tar.gz
samba-8faa1f4f9af114985b0c6b7383f0f1c935e83f9f.tar.bz2
samba-8faa1f4f9af114985b0c6b7383f0f1c935e83f9f.zip
r12577: filter the loopback addresses like this 127.*.*.* and not only 127.0.0.1
metze (This used to be commit 3b32d8b6b6565d8c5b3f7e653fdc385cc8cb96ef)
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/interfaces.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index f607c070d8..344d1b57d3 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -251,15 +251,22 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
struct nbtd_server *nbtsrv = iface->nbtsrv;
const char **ret = NULL;
struct nbtd_interface *iface2;
+ BOOL is_loopback = False;
if (iface->ip_address) {
+ is_loopback = iface_same_net(iface->ip_address, "127.0.0.1", "255.0.0.0");
ret = str_list_add(ret, iface->ip_address);
}
for (iface2=nbtsrv->interfaces;iface2;iface2=iface2->next) {
- if (iface->ip_address &&
- strcmp(iface2->ip_address, iface->ip_address) == 0) {
- continue;
+ if (iface2 == iface) continue;
+
+ if (!iface2->ip_address) continue;
+
+ if (!is_loopback) {
+ if (iface_same_net(iface2->ip_address, "127.0.0.1", "255.0.0.0")) {
+ continue;
+ }
}
ret = str_list_add(ret, iface2->ip_address);
@@ -267,15 +274,6 @@ const char **nbtd_address_list(struct nbtd_interface *iface, TALLOC_CTX *mem_ctx
talloc_steal(mem_ctx, ret);
- /* if the query didn't come from loopback, then never give out
- loopback in the reply, as loopback means something
- different for the recipient than for us */
- if (ret != NULL &&
- iface->ip_address != NULL &&
- strcmp(iface->ip_address, "127.0.0.1") != 0) {
- str_list_remove(ret, "127.0.0.1");
- }
-
return ret;
}