Author: metze
Date: 2005-12-29 16:58:35 +0000 (Thu, 29 Dec 2005)
New Revision: 12577

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12577

Log:
filter the loopback addresses like this 127.*.*.* and not only 127.0.0.1

metze
Modified:
   branches/SAMBA_4_0/source/nbt_server/interfaces.c


Changeset:
Modified: branches/SAMBA_4_0/source/nbt_server/interfaces.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/interfaces.c   2005-12-29 16:26:06 UTC 
(rev 12576)
+++ branches/SAMBA_4_0/source/nbt_server/interfaces.c   2005-12-29 16:58:35 UTC 
(rev 12577)
@@ -251,15 +251,22 @@
        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 @@
 
        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;
 }
 

Reply via email to