r4045: readd krb5 support defaulted to disable
[gd/samba-autobuild/.git] / source / libcli / namequery.c
index 2f6343dcaffc5df7c176d6e342b2ee096dba4432..85270c10019265f24fd5be672af978372399b5db 100644 (file)
 */
 
 #include "includes.h"
+#include "system/network.h"
+#include "system/time.h"
+
+/* A netbios node status array element. */
+struct node_status {
+       char name[16];
+       uint8_t type;
+       uint8_t flags;
+};
+
 
 /* nmbd.c sets this to True. */
 BOOL global_in_nmbd = False;
@@ -37,7 +47,7 @@ static int generate_trn_id(void)
 
        trn_id = sys_random();
 
-       return trn_id % (unsigned)0x7FFF;
+       return trn_id % (uint_t)0x7FFF;
 }
 
 
@@ -75,7 +85,7 @@ do a NBT node status query on an open socket and return an array of
 structures holding the returned names or NULL if the query failed
 **************************************************************************/
 struct node_status *node_status_query(int fd,struct nmb_name *name,
-                                     struct in_addr to_ip, int *num_names)
+                                     struct ipv4_addr to_ip, int *num_names)
 {
        BOOL found=False;
        int retries = 2;
@@ -162,7 +172,7 @@ a servers name given its IP
 return the matched name in *name
 **************************************************************************/
 
-BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr to_ip, char *name)
+BOOL name_status_find(const char *q_name, int q_type, int type, struct ipv4_addr to_ip, char *name)
 {
        struct node_status *status = NULL;
        struct nmb_name nname;
@@ -176,7 +186,7 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t
        }
 
        DEBUG(10, ("name_status_find: looking up %s#%02x at %s\n", q_name, 
-                  q_type, inet_ntoa(to_ip)));
+                  q_type, sys_inet_ntoa(to_ip)));
 
        sock = open_socket_in(SOCK_DGRAM, 0, 3, interpret_addr(lp_socket_address()), True);
        if (sock == -1)
@@ -205,7 +215,7 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t
        DEBUG(10, ("name_status_find: name %sfound", result ? "" : "not "));
 
        if (result)
-               DEBUGADD(10, (", ip address is %s", inet_ntoa(to_ip)));
+               DEBUGADD(10, (", ip address is %s", sys_inet_ntoa(to_ip)));
 
        DEBUG(10, ("\n"));      
 
@@ -216,18 +226,18 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t
 /*
   comparison function used by sort_ip_list
 */
-int ip_compare(struct in_addr *ip1, struct in_addr *ip2)
+int ip_compare(struct ipv4_addr *ip1, struct ipv4_addr *ip2)
 {
        int max_bits1=0, max_bits2=0;
        int num_interfaces = iface_count();
        int i;
 
        for (i=0;i<num_interfaces;i++) {
-               struct in_addr ip;
+               struct ipv4_addr ip;
                int bits1, bits2;
                ip = *iface_n_bcast(i);
-               bits1 = matching_quad_bits((uchar *)&ip1->s_addr, (uchar *)&ip.s_addr);
-               bits2 = matching_quad_bits((uchar *)&ip2->s_addr, (uchar *)&ip.s_addr);
+               bits1 = matching_quad_bits((uint8_t *)&ip1->addr, (uint8_t *)&ip.addr);
+               bits2 = matching_quad_bits((uint8_t *)&ip2->addr, (uint8_t *)&ip.addr);
                max_bits1 = MAX(bits1, max_bits1);
                max_bits2 = MAX(bits2, max_bits2);
        }       
@@ -248,13 +258,13 @@ int ip_compare(struct in_addr *ip1, struct in_addr *ip2)
   are at the top. This prevents the problem where a WINS server returns an IP that
   is not reachable from our subnet as the first match
 */
-static void sort_ip_list(struct in_addr *iplist, int count)
+static void sort_ip_list(struct ipv4_addr *iplist, int count)
 {
        if (count <= 1) {
                return;
        }
 
-       qsort(iplist, count, sizeof(struct in_addr), QSORT_CAST ip_compare);    
+       qsort(iplist, count, sizeof(struct ipv4_addr), QSORT_CAST ip_compare);  
 }
 
 
@@ -264,9 +274,9 @@ static void sort_ip_list(struct in_addr *iplist, int count)
  *count will be set to the number of addresses returned.
  *timed_out is set if we failed by timing out
 ****************************************************************************/
-struct in_addr *name_query(int fd,const char *name,int name_type, 
+struct ipv4_addr *name_query(int fd,const char *name,int name_type, 
                           BOOL bcast,BOOL recurse,
-                          struct in_addr to_ip, int *count, int *flags,
+                          struct ipv4_addr to_ip, int *count, int *flags,
                           BOOL *timed_out)
 {
        BOOL found=False;
@@ -276,7 +286,7 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
        struct packet_struct p;
        struct packet_struct *p2;
        struct nmb_packet *nmb = &p.packet.nmb;
-       struct in_addr *ip_list = NULL;
+       struct ipv4_addr *ip_list = NULL;
 
        if (lp_disable_netbios()) {
                DEBUG(5,("name_query(%s#%02x): netbios is disabled\n", name, name_type));
@@ -325,7 +335,7 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
        
        while (1) {
                struct timeval tval2;
-               struct in_addr *tmp_ip_list;
+               struct ipv4_addr *tmp_ip_list;
                
                GetTimeOfDay(&tval2);
                if (TvalDiff(&tval,&tval2) > retry_time) {
@@ -390,7 +400,7 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
                                continue;
                        }
                        
-                       tmp_ip_list = (struct in_addr *)Realloc( ip_list, sizeof( ip_list[0] )
+                       tmp_ip_list = (struct ipv4_addr *)Realloc( ip_list, sizeof( ip_list[0] )
                                                                 * ( (*count) + nmb2->answers->rdlength/6 ) );
                        
                        if (!tmp_ip_list) {
@@ -401,10 +411,10 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
                        ip_list = tmp_ip_list;
                        
                        if (ip_list) {
-                               DEBUG(2,("Got a positive name query response from %s ( ", inet_ntoa(p2->ip)));
+                               DEBUG(2,("Got a positive name query response from %s ( ", sys_inet_ntoa(p2->ip)));
                                for (i=0;i<nmb2->answers->rdlength/6;i++) {
                                        putip((char *)&ip_list[(*count)],&nmb2->answers->rdata[2+i*6]);
-                                       DEBUGADD(2,("%s ",inet_ntoa(ip_list[(*count)])));
+                                       DEBUGADD(2,("%s ",sys_inet_ntoa(ip_list[(*count)])));
                                        (*count)++;
                                }
                                DEBUGADD(2,(")\n"));
@@ -446,124 +456,12 @@ struct in_addr *name_query(int fd,const char *name,int name_type,
        return ip_list;
 }
 
-/********************************************************
- Start parsing the lmhosts file.
-*********************************************************/
-
-XFILE *startlmhosts(char *fname)
-{
-       XFILE *fp = x_fopen(fname,O_RDONLY, 0);
-       if (!fp) {
-               DEBUG(4,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
-                        fname, strerror(errno)));
-               return NULL;
-       }
-       return fp;
-}
-
-/********************************************************
- Parse the next line in the lmhosts file.
-*********************************************************/
-
-BOOL getlmhostsent( TALLOC_CTX *mem_ctx,
-               XFILE *fp, pstring name, int *name_type, struct in_addr *ipaddr)
-{
-  pstring line;
-
-  while(!x_feof(fp) && !x_ferror(fp)) {
-    pstring ip,flags,extra;
-    const char *ptr;
-    char *ptr1;
-    int count = 0;
-
-    *name_type = -1;
-
-    if (!fgets_slash(line,sizeof(pstring),fp))
-      continue;
-
-    if (*line == '#')
-      continue;
-
-    pstrcpy(ip,"");
-    pstrcpy(name,"");
-    pstrcpy(flags,"");
-
-    ptr = line;
-
-    if (next_token(&ptr,ip   ,NULL,sizeof(ip)))
-      ++count;
-    if (next_token(&ptr,name ,NULL, sizeof(pstring)))
-      ++count;
-    if (next_token(&ptr,flags,NULL, sizeof(flags)))
-      ++count;
-    if (next_token(&ptr,extra,NULL, sizeof(extra)))
-      ++count;
-
-    if (count <= 0)
-      continue;
-
-    if (count > 0 && count < 2)
-    {
-      DEBUG(0,("getlmhostsent: Ill formed hosts line [%s]\n",line));
-      continue;
-    }
-
-    if (count >= 4)
-    {
-      DEBUG(0,("getlmhostsent: too many columns in lmhosts file (obsolete syntax)\n"));
-      continue;
-    }
-
-    DEBUG(4, ("getlmhostsent: lmhost entry: %s %s %s\n", ip, name, flags));
-
-    if (strchr_m(flags,'G') || strchr_m(flags,'S'))
-    {
-      DEBUG(0,("getlmhostsent: group flag in lmhosts ignored (obsolete)\n"));
-      continue;
-    }
-
-    *ipaddr = *interpret_addr2(mem_ctx, ip);
-
-    /* Extra feature. If the name ends in '#XX', where XX is a hex number,
-       then only add that name type. */
-    if((ptr1 = strchr_m(name, '#')) != NULL)
-    {
-      char *endptr;
-
-      ptr1++;
-      *name_type = (int)strtol(ptr1, &endptr, 16);
-
-      if(!*ptr1 || (endptr == ptr1))
-      {
-        DEBUG(0,("getlmhostsent: invalid name %s containing '#'.\n", name));
-        continue;
-      }
-
-      *(--ptr1) = '\0'; /* Truncate at the '#' */
-    }
-
-    return True;
-  }
-
-  return False;
-}
-
-/********************************************************
- Finish parsing the lmhosts file.
-*********************************************************/
-
-void endlmhosts(XFILE *fp)
-{
-       x_fclose(fp);
-}
-
-
 /********************************************************
  Resolve via "bcast" method.
 *********************************************************/
 
 BOOL name_resolve_bcast(const char *name, int name_type,
-                       struct in_addr **return_ip_list, int *return_count)
+                       struct ipv4_addr **return_ip_list, int *return_count)
 {
        int sock, i;
        int num_interfaces = iface_count();
@@ -593,7 +491,7 @@ BOOL name_resolve_bcast(const char *name, int name_type,
         * the first successful match.
         */
        for( i = num_interfaces-1; i >= 0; i--) {
-               struct in_addr sendto_ip;
+               struct ipv4_addr sendto_ip;
                int flags;
                /* Done this way to fix compiler error on IRIX 5.x */
                sendto_ip = *iface_n_bcast(i);
@@ -613,11 +511,11 @@ BOOL name_resolve_bcast(const char *name, int name_type,
  Resolve via "wins" method.
 *********************************************************/
 BOOL resolve_wins(TALLOC_CTX *mem_ctx, const char *name, int name_type,
-                 struct in_addr **return_iplist, int *return_count)
+                 struct ipv4_addr **return_iplist, int *return_count)
 {
        int sock, t, i;
        char **wins_tags;
-       struct in_addr src_ip;
+       struct ipv4_addr src_ip;
 
        if (lp_disable_netbios()) {
                DEBUG(5,("resolve_wins(%s#%02x): netbios is disabled\n", name, name_type));
@@ -643,14 +541,14 @@ BOOL resolve_wins(TALLOC_CTX *mem_ctx, const char *name, int name_type,
        }
 
        /* the address we will be sending from */
-       src_ip = *interpret_addr2(mem_ctx, lp_socket_address());
+       src_ip = interpret_addr2(lp_socket_address());
 
        /* in the worst case we will try every wins server with every
           tag! */
        for (t=0; wins_tags && wins_tags[t]; t++) {
                int srv_count = wins_srv_count_tag(wins_tags[t]);
                for (i=0; i<srv_count; i++) {
-                       struct in_addr wins_ip;
+                       struct ipv4_addr wins_ip;
                        int flags;
                        BOOL timed_out;
 
@@ -666,9 +564,9 @@ BOOL resolve_wins(TALLOC_CTX *mem_ctx, const char *name, int name_type,
                                continue;
                        }
 
-                       DEBUG(3,("resolve_wins: using WINS server %s and tag '%s'\n", inet_ntoa(wins_ip), wins_tags[t]));
+                       DEBUG(3,("resolve_wins: using WINS server %s and tag '%s'\n", sys_inet_ntoa(wins_ip), wins_tags[t]));
 
-                       sock = open_socket_in(SOCK_DGRAM, 0, 3, src_ip.s_addr, True);
+                       sock = open_socket_in(SOCK_DGRAM, 0, 3, src_ip.addr, True);
                        if (sock == -1) {
                                continue;
                        }
@@ -706,7 +604,7 @@ success:
 *********************************************************/
 
 static BOOL resolve_hosts(const char *name,
-                         struct in_addr **return_iplist, int *return_count)
+                         struct ipv4_addr **return_iplist, int *return_count)
 {
        /*
         * "host" means do a localhost, or dns lookup.
@@ -719,9 +617,9 @@ static BOOL resolve_hosts(const char *name,
        DEBUG(3,("resolve_hosts: Attempting host lookup for name %s<0x20>\n", name));
        
        if (((hp = sys_gethostbyname(name)) != NULL) && (hp->h_addr != NULL)) {
-               struct in_addr return_ip;
+               struct ipv4_addr return_ip;
                putip((char *)&return_ip,(char *)hp->h_addr);
-               *return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
+               *return_iplist = (struct ipv4_addr *)malloc(sizeof(struct ipv4_addr));
                if(*return_iplist == NULL) {
                        DEBUG(3,("resolve_hosts: malloc fail !\n"));
                        return False;
@@ -741,7 +639,7 @@ static BOOL resolve_hosts(const char *name,
 *********************************************************/
 
 static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int name_type,
-                                 struct in_addr **return_iplist, int *return_count)
+                                 struct ipv4_addr **return_iplist, int *return_count)
 {
   char *name_resolve_list;
   fstring tok;
@@ -750,7 +648,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
   BOOL allzeros = (strcmp(name,"0.0.0.0") == 0);
   BOOL is_address = is_ipaddress(name);
   BOOL result = False;
-  struct in_addr *nodupes_iplist;
+  struct ipv4_addr *nodupes_iplist;
   int i;
 
   *return_iplist = NULL;
@@ -759,19 +657,19 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
   DEBUG(10, ("internal_resolve_name: looking up %s#%x\n", name, name_type));
 
   if (allzeros || allones || is_address) {
-       *return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
+       *return_iplist = (struct ipv4_addr *)malloc(sizeof(struct ipv4_addr));
        if(*return_iplist == NULL) {
                DEBUG(3,("internal_resolve_name: malloc fail !\n"));
                return False;
        }
        if(is_address) { 
                /* if it's in the form of an IP address then get the lib to interpret it */
-               if (((*return_iplist)->s_addr = inet_addr(name)) == 0xFFFFFFFF ){
+               if (((*return_iplist)->addr = inet_addr(name)) == 0xFFFFFFFF ){
                        DEBUG(1,("internal_resolve_name: inet_addr failed on %s\n", name));
                        return False;
                }
        } else {
-               (*return_iplist)->s_addr = allones ? 0xFFFFFFFF : 0;
+               (*return_iplist)->addr = allones ? 0xFFFFFFFF : 0;
                *return_count = 1;
        }
     return True;
@@ -801,7 +699,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
                  }
          } else if(strequal( tok, "lmhosts")) {
                        /* REWRITE: add back in? */
-                       DEBUG(0,("resolve_name: REWRITE: add lmhosts back?? %s\n", tok));
+                       DEBUG(2,("resolve_name: REWRITE: add lmhosts back?? %s\n", tok));
          } else if(strequal( tok, "wins")) {
                  /* don't resolve 1D via WINS */
                  if (name_type != 0x1D &&
@@ -833,8 +731,8 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
      controllers including the PDC in iplist[1..n].  Iterating over
      the iplist when the PDC is down will cause two sets of timeouts. */
 
-  if (*return_count && (nodupes_iplist = (struct in_addr *)
-       malloc(sizeof(struct in_addr) * (*return_count)))) {
+  if (*return_count && (nodupes_iplist = (struct ipv4_addr *)
+       malloc(sizeof(struct ipv4_addr) * (*return_count)))) {
          int nodupes_count = 0;
 
          /* Iterate over return_iplist looking for duplicates */
@@ -844,7 +742,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
                  int j;
 
                  for (j = i + 1; j < *return_count; j++) {
-                         if (ip_equal((*return_iplist)[i], 
+                         if (ipv4_equal((*return_iplist)[i], 
                                       (*return_iplist)[j])) {
                                  is_dupe = True;
                                  break;
@@ -871,7 +769,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
   /* Save in name cache */
   for (i = 0; i < *return_count && DEBUGLEVEL == 100; i++)
     DEBUG(100, ("Storing name %s of type %d (ip: %s)\n", name,
-                name_type, inet_ntoa((*return_iplist)[i])));
+                name_type, sys_inet_ntoa((*return_iplist)[i])));
     
   namecache_store(mem_ctx, name, name_type, *return_count, *return_iplist);
 
@@ -881,7 +779,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
             *return_count));
 
   for (i = 0; i < *return_count; i++)
-         DEBUGADD(10, ("%s ", inet_ntoa((*return_iplist)[i])));
+         DEBUGADD(10, ("%s ", sys_inet_ntoa((*return_iplist)[i])));
 
   DEBUG(10, ("\n"));
 
@@ -894,13 +792,13 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
  or host name or NetBIOS name. This uses the name switch in the
  smb.conf to determine the order of name resolution.
 *********************************************************/
-BOOL resolve_name(TALLOC_CTX *mem_ctx, const char *name, struct in_addr *return_ip, int name_type)
+BOOL resolve_name(TALLOC_CTX *mem_ctx, const char *name, struct ipv4_addr *return_ip, int name_type)
 {
-       struct in_addr *ip_list = NULL;
+       struct ipv4_addr *ip_list = NULL;
        int count = 0;
 
        if (is_ipaddress(name)) {
-               *return_ip = *interpret_addr2(mem_ctx, name);
+               *return_ip = interpret_addr2(name);
                return True;
        }
 
@@ -908,7 +806,7 @@ BOOL resolve_name(TALLOC_CTX *mem_ctx, const char *name, struct in_addr *return_
                int i;
                /* only return valid addresses for TCP connections */
                for (i=0; i<count; i++) {
-                       char *ip_str = inet_ntoa(ip_list[i]);
+                       const char *ip_str = sys_inet_ntoa(ip_list[i]);
                        if (ip_str &&
                            strcmp(ip_str, "255.255.255.255") != 0 &&
                            strcmp(ip_str, "0.0.0.0") != 0) {
@@ -926,9 +824,9 @@ BOOL resolve_name(TALLOC_CTX *mem_ctx, const char *name, struct in_addr *return_
  Find the IP address of the master browser or DMB for a workgroup.
 *********************************************************/
 
-BOOL find_master_ip(TALLOC_CTX *mem_ctx, const char *group, struct in_addr *master_ip)
+BOOL find_master_ip(TALLOC_CTX *mem_ctx, const char *group, struct ipv4_addr *master_ip)
 {
-       struct in_addr *ip_list = NULL;
+       struct ipv4_addr *ip_list = NULL;
        int count = 0;
 
        if (lp_disable_netbios()) {
@@ -956,7 +854,7 @@ BOOL find_master_ip(TALLOC_CTX *mem_ctx, const char *group, struct in_addr *mast
 *********************************************************/
 
 BOOL lookup_dc_name(const char *srcname, const char *domain, 
-                   struct in_addr *dc_ip, char *ret_name)
+                   struct ipv4_addr *dc_ip, char *ret_name)
 {
 #if !defined(I_HATE_WINDOWS_REPLY_CODE)        
        fstring dc_name;
@@ -1121,8 +1019,8 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all...
                        buf -= 4;
 
                        if (CVAL(buf,smb_com) != SMBtrans) {
-                               DEBUG(0,("lookup_pdc_name: datagram type %u != SMBtrans(%u)\n", (unsigned int)
-                                        CVAL(buf,smb_com), (unsigned int)SMBtrans ));
+                               DEBUG(0,("lookup_pdc_name: datagram type %u != SMBtrans(%u)\n", (uint_t)
+                                        CVAL(buf,smb_com), (uint_t)SMBtrans ));
                                free_packet(p_ret);
                                continue;
                        }
@@ -1138,11 +1036,11 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all...
 
                        DEBUG(4,("lookup_pdc_name: datagram reply from %s to %s IP %s for %s of type %d len=%d\n",
                                 nmb_namestr(&dgram2->source_name),nmb_namestr(&dgram2->dest_name),
-                                inet_ntoa(p_ret->ip), smb_buf(buf),SVAL(buf2,0),len));
+                                sys_inet_ntoa(p_ret->ip), smb_buf(buf),SVAL(buf2,0),len));
 
                        if(SVAL(buf2,0) != QUERYFORPDC_R) {
                                DEBUG(0,("lookup_pdc_name: datagram type (%u) != QUERYFORPDC_R(%u)\n",
-                                        (unsigned int)SVAL(buf,0), (unsigned int)QUERYFORPDC_R ));
+                                        (uint_t)SVAL(buf,0), (uint_t)QUERYFORPDC_R ));
                                free_packet(p_ret);
                                continue;
                        }
@@ -1167,9 +1065,9 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all...
  for a domain.
 *********************************************************/
 
-BOOL get_pdc_ip(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr *ip)
+BOOL get_pdc_ip(TALLOC_CTX *mem_ctx, const char *domain, struct ipv4_addr *ip)
 {
-       struct in_addr *ip_list;
+       struct ipv4_addr *ip_list;
        int count;
        int i = 0;
 
@@ -1209,7 +1107,7 @@ BOOL get_pdc_ip(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr *ip)
  a domain.
 *********************************************************/
 
-BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_list, int *count, int *ordered)
+BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct ipv4_addr **ip_list, int *count, int *ordered)
 {
 
        *ordered = False;
@@ -1217,13 +1115,13 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_li
        /* If it's our domain then use the 'password server' parameter. */
 
        if (strequal(domain, lp_workgroup())) {
-               char *p;
-               char *pserver = lp_passwordserver(); /* UNIX charset. */
+               const char *p;
+               const char *pserver = lp_passwordserver(); /* UNIX charset. */
                fstring name;
                int num_addresses = 0;
                int  local_count, i, j;
-               struct in_addr *return_iplist = NULL;
-               struct in_addr *auto_ip_list = NULL;
+               struct ipv4_addr *return_iplist = NULL;
+               struct ipv4_addr *auto_ip_list = NULL;
                BOOL done_auto_lookup = False;
                int auto_count = 0;
                
@@ -1258,7 +1156,7 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_li
                if ( (num_addresses == 0) && !done_auto_lookup )
                        return internal_resolve_name(mem_ctx, domain, 0x1C, ip_list, count);
 
-               return_iplist = (struct in_addr *)malloc(num_addresses * sizeof(struct in_addr));
+               return_iplist = (struct ipv4_addr *)malloc(num_addresses * sizeof(struct ipv4_addr));
 
                if (return_iplist == NULL) {
                        DEBUG(3,("get_dc_list: malloc fail !\n"));
@@ -1271,7 +1169,7 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_li
                /* fill in the return list now with real IP's */
                                
                while ( (local_count<num_addresses) && next_token(&p,name,LIST_SEP,sizeof(name)) ) {
-                       struct in_addr name_ip;
+                       struct ipv4_addr name_ip;
                        
                        /* copy any addersses from the auto lookup */
                        
@@ -1302,7 +1200,7 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_li
                                        continue;
                                        
                                for ( j=i+1; j<local_count; j++ ) {
-                                       if ( ip_equal( return_iplist[i], return_iplist[j]) )
+                                       if ( ipv4_equal( return_iplist[i], return_iplist[j]) )
                                                zero_ip(&return_iplist[j]);
                                }
                        }