Fix the build WITH_DNS_UPDATES.
[samba.git] / source3 / utils / net_dns.c
index cacd93fa276dacf09431568b6f2338790ed96440..8b82a96892d12cb3776ec3e10dc6e14c714d592e 100644 (file)
@@ -17,8 +17,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  
 */
 
 #include "includes.h"
 
 #if defined(WITH_DNS_UPDATES)
 
+/*
+ * Silly prototype to get rid of a warning
+ */
+
+DNS_ERROR DoDNSUpdate(char *pszServerName,
+                     const char *pszDomainName, const char *pszHostName,
+                     const struct in_addr *iplist, size_t num_addrs );
+
 /*********************************************************************
 *********************************************************************/
 
@@ -138,7 +145,6 @@ int get_my_ip_address( struct in_addr **ips )
 {
        struct iface_struct nics[MAX_INTERFACES];
        int i, n;
-       struct in_addr loopback_ip = *interpret_addr2("127.0.0.1");
        struct in_addr *list;
        int count = 0;
 
@@ -151,8 +157,14 @@ int get_my_ip_address( struct in_addr **ips )
        }
 
        for ( i=0; i<n; i++ ) {
-               if ( nics[i].ip.s_addr != loopback_ip.s_addr ) {
-                       memcpy( &list[count++], &nics[i].ip, sizeof( struct in_addr ) );
+               if ((nics[i].ip.ss_family == AF_INET)) {
+                       struct in_addr ifip;
+
+                       ifip = ((const struct sockaddr_in *)&nics[i].ip)->sin_addr;
+
+                       if (!is_loopback_ip_v4(ifip)) {
+                               memcpy(&list[count++], &ifip, sizeof(struct in_addr));
+                       }
                }
        }
        *ips = list;
@@ -160,6 +172,12 @@ int get_my_ip_address( struct in_addr **ips )
        return count;
 }
 
+/*
+ * Silly prototype to get rid of a warning
+ */
+
+DNS_ERROR do_gethostbyname(const char *server, const char *host);
+
 DNS_ERROR do_gethostbyname(const char *server, const char *host)
 {
        struct dns_connection *conn;