summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 22:48:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:11 -0500
commit284349482f5293a9a23d0f72d7c2aab46b55843b (patch)
tree6f96931afb18ea841983a2895b62c97fed9f77b7 /source4/libcli
parent9f14afa12c11d02a49f4f310c3f8d834ce8a835d (diff)
downloadsamba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.gz
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.bz2
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.zip
r3443: the next stage in the include files re-organisation.
I have created the include/system/ directory, which will contain the wrappers for the system includes for logical subsystems. So far I have created include/system/kerberos.h and include/system/network.h, which contain all the system includes for kerberos code and networking code. These are the included in subsystems that need kerberos or networking respectively. Note that this method avoids the mess of #ifdef HAVE_XXX_H in every C file, instead each C module includes the include/system/XXX.h file for the logical system support it needs, and the details are kept isolated in include/system/ This patch also creates a "struct ipv4_addr" which replaces "struct in_addr" in our code. That avoids every C file needing to import all the system networking headers. (This used to be commit 2e25c71853f8996f73755277e448e7d670810349)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/auth/clikrb5.c2
-rw-r--r--source4/libcli/auth/gensec_krb5.c2
-rw-r--r--source4/libcli/auth/kerberos.c1
-rw-r--r--source4/libcli/auth/kerberos_verify.c2
-rw-r--r--source4/libcli/cliconnect.c2
-rw-r--r--source4/libcli/ldap/ldap.c3
-rw-r--r--source4/libcli/namecache.c6
-rw-r--r--source4/libcli/namequery.c93
-rw-r--r--source4/libcli/namequery_dc.c6
-rw-r--r--source4/libcli/nmblib.c15
-rw-r--r--source4/libcli/raw/clisocket.c6
-rw-r--r--source4/libcli/raw/libcliraw.h2
12 files changed, 75 insertions, 65 deletions
diff --git a/source4/libcli/auth/clikrb5.c b/source4/libcli/auth/clikrb5.c
index c3ea33aaec..6f17bddfa0 100644
--- a/source4/libcli/auth/clikrb5.c
+++ b/source4/libcli/auth/clikrb5.c
@@ -20,6 +20,8 @@
*/
#include "includes.h"
+#include "system/network.h"
+#include "system/kerberos.h"
#ifdef HAVE_KRB5
diff --git a/source4/libcli/auth/gensec_krb5.c b/source4/libcli/auth/gensec_krb5.c
index 95cc6bacbe..f393ce09c1 100644
--- a/source4/libcli/auth/gensec_krb5.c
+++ b/source4/libcli/auth/gensec_krb5.c
@@ -24,6 +24,8 @@
*/
#include "includes.h"
+#include "system/kerberos.h"
+#include "libcli/auth/kerberos.h"
#include "librpc/gen_ndr/ndr_krb5pac.h"
#undef DBGC_CLASS
diff --git a/source4/libcli/auth/kerberos.c b/source4/libcli/auth/kerberos.c
index b08c7f505c..06e89d4d33 100644
--- a/source4/libcli/auth/kerberos.c
+++ b/source4/libcli/auth/kerberos.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "system/kerberos.h"
#ifdef HAVE_KRB5
diff --git a/source4/libcli/auth/kerberos_verify.c b/source4/libcli/auth/kerberos_verify.c
index 8d050182f9..8e598e2a66 100644
--- a/source4/libcli/auth/kerberos_verify.c
+++ b/source4/libcli/auth/kerberos_verify.c
@@ -23,6 +23,8 @@
*/
#include "includes.h"
+#include "system/kerberos.h"
+#include "libcli/auth/kerberos.h"
#ifdef HAVE_KRB5
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index c3bc43aa8c..2949633b86 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -154,7 +154,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
struct smbcli_state **ret_cli,
const char *myname,
const char *host,
- struct in_addr *ip,
+ struct ipv4_addr *ip,
const char *sharename,
const char *devtype,
const char *username,
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 6e182c3843..1eb7888d41 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -24,6 +24,7 @@
*/
#include "includes.h"
+#include "system/network.h"
/****************************************************************************
*
@@ -1272,7 +1273,7 @@ struct ldap_connection *new_ldap_connection(void)
BOOL ldap_connect(struct ldap_connection *conn, const char *url)
{
struct hostent *hp;
- struct in_addr ip;
+ struct ipv4_addr ip;
if (!ldap_parse_basic_url(conn->mem_ctx, url, &conn->host,
&conn->port, &conn->ldaps))
diff --git a/source4/libcli/namecache.c b/source4/libcli/namecache.c
index 9f4796af1a..8a4dab7522 100644
--- a/source4/libcli/namecache.c
+++ b/source4/libcli/namecache.c
@@ -113,7 +113,7 @@ static char* namecache_key(TALLOC_CTX *mem_ctx, const char *name, int name_type)
**/
BOOL namecache_store(TALLOC_CTX *mem_ctx, const char *name, int name_type,
- int num_names, struct in_addr *ip_list)
+ int num_names, struct ipv4_addr *ip_list)
{
time_t expiry;
char *key, *value_string;
@@ -129,7 +129,7 @@ BOOL namecache_store(TALLOC_CTX *mem_ctx, const char *name, int name_type,
num_names, num_names == 1 ? "": "es", name, name_type));
for (i = 0; i < num_names; i++)
- DEBUGADD(5, ("%s%s", inet_ntoa(ip_list[i]),
+ DEBUGADD(5, ("%s%s", sys_inet_ntoa(ip_list[i]),
i == (num_names - 1) ? "" : ", "));
DEBUGADD(5, ("\n"));
@@ -172,7 +172,7 @@ BOOL namecache_store(TALLOC_CTX *mem_ctx, const char *name, int name_type,
* false if name isn't found in the cache or has expired
**/
-BOOL namecache_fetch(TALLOC_CTX *mem_ctx, const char *name, int name_type, struct in_addr **ip_list,
+BOOL namecache_fetch(TALLOC_CTX *mem_ctx, const char *name, int name_type, struct ipv4_addr **ip_list,
int *num_names)
{
char *key, *value;
diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c
index a9464718c5..7a2d697797 100644
--- a/source4/libcli/namequery.c
+++ b/source4/libcli/namequery.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "system/network.h"
/* A netbios node status array element. */
struct node_status {
@@ -83,7 +84,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;
@@ -170,7 +171,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;
@@ -184,7 +185,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)
@@ -213,7 +214,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"));
@@ -224,14 +225,14 @@ 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((uint8_t *)&ip1->s_addr, (uint8_t *)&ip.s_addr);
@@ -256,13 +257,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);
}
@@ -272,9 +273,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;
@@ -284,7 +285,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));
@@ -333,7 +334,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) {
@@ -398,7 +399,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) {
@@ -409,10 +410,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"));
@@ -474,7 +475,7 @@ XFILE *startlmhosts(char *fname)
*********************************************************/
BOOL getlmhostsent( TALLOC_CTX *mem_ctx,
- XFILE *fp, pstring name, int *name_type, struct in_addr *ipaddr)
+ XFILE *fp, pstring name, int *name_type, struct ipv4_addr *ipaddr)
{
pstring line;
@@ -571,7 +572,7 @@ void endlmhosts(XFILE *fp)
*********************************************************/
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();
@@ -601,7 +602,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);
@@ -621,11 +622,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));
@@ -658,7 +659,7 @@ BOOL resolve_wins(TALLOC_CTX *mem_ctx, const char *name, int name_type,
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;
@@ -674,7 +675,7 @@ 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);
if (sock == -1) {
@@ -714,7 +715,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.
@@ -727,9 +728,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;
@@ -749,7 +750,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;
@@ -758,7 +759,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;
@@ -767,7 +768,7 @@ 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;
@@ -841,8 +842,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 */
@@ -879,7 +880,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);
@@ -889,7 +890,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"));
@@ -902,9 +903,9 @@ 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)) {
@@ -916,7 +917,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) {
@@ -934,9 +935,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()) {
@@ -964,7 +965,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;
@@ -1146,7 +1147,7 @@ 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",
@@ -1175,9 +1176,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;
@@ -1217,7 +1218,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;
@@ -1230,8 +1231,8 @@ BOOL get_dc_list(TALLOC_CTX *mem_ctx, const char *domain, struct in_addr **ip_li
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;
@@ -1266,7 +1267,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"));
@@ -1279,7 +1280,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 */
diff --git a/source4/libcli/namequery_dc.c b/source4/libcli/namequery_dc.c
index 16e5282497..6c341af401 100644
--- a/source4/libcli/namequery_dc.c
+++ b/source4/libcli/namequery_dc.c
@@ -28,9 +28,9 @@
/*
find the DC for a domain using methods appropriate for a RPC domain
*/
-BOOL rpc_find_dc(const char *domain, fstring srv_name, struct in_addr *ip_out)
+BOOL rpc_find_dc(const char *domain, fstring srv_name, struct ipv4_addr *ip_out)
{
- struct in_addr *ip_list = NULL, dc_ip, exclude_ip;
+ struct ipv4_addr *ip_list = NULL, dc_ip, exclude_ip;
int count, i;
BOOL list_ordered;
BOOL use_pdc_only;
@@ -69,7 +69,7 @@ BOOL rpc_find_dc(const char *domain, fstring srv_name, struct in_addr *ip_out)
/* Pick a nice close server, but only if the list was not ordered */
if (!list_ordered && (count > 1) ) {
- qsort(ip_list, count, sizeof(struct in_addr), QSORT_CAST ip_compare);
+ qsort(ip_list, count, sizeof(struct ipv4_addr), QSORT_CAST ip_compare);
}
for (i = 0; i < count; i++) {
diff --git a/source4/libcli/nmblib.c b/source4/libcli/nmblib.c
index 5eeec48003..ef5210cf63 100644
--- a/source4/libcli/nmblib.c
+++ b/source4/libcli/nmblib.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "system/network.h"
static const struct opcode_names {
const char *nmb_opcode_name;
@@ -102,7 +103,7 @@ void debug_nmb_packet(struct packet_struct *p)
if (DEBUGLVL(4)) {
DEBUG(4, ("nmb packet from %s(%d) header: id=%d opcode=%s(%d) response=%s\n",
- inet_ntoa(p->ip), p->port,
+ sys_inet_ntoa(p->ip), p->port,
nmb->header.name_trn_id,
lookup_opcode_name(nmb->header.opcode),
nmb->header.opcode,
@@ -696,7 +697,7 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
struct packet_struct *packet;
char buf[MAX_DGRAM_SIZE];
int length;
- struct in_addr addr;
+ struct ipv4_addr addr;
int port;
length = read_udp_socket(fd, buf, sizeof(buf), &addr, &port);
@@ -710,7 +711,7 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
packet->port = port;
DEBUG(5,("Received a packet of len %d from (%s) port %d\n",
- length, inet_ntoa(packet->ip), packet->port));
+ length, sys_inet_ntoa(packet->ip), packet->port));
return packet;
}
@@ -719,7 +720,7 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
/*******************************************************************
send a udp packet on a already open socket
******************************************************************/
-static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
+static BOOL send_udp(int fd,char *buf,int len,struct ipv4_addr ip,int port)
{
BOOL ret = False;
int i;
@@ -732,7 +733,7 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
sock_out.sin_family = AF_INET;
DEBUG( 5, ( "Sending a packet of len %d to (%s) on port %d\n",
- len, inet_ntoa(ip), port ) );
+ len, sys_inet_ntoa(ip), port ) );
/*
* Patch to fix asynch error notifications from Linux kernel.
@@ -746,7 +747,7 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
if (!ret)
DEBUG(0,("Packet send failed to %s(%d) ERRNO=%s\n",
- inet_ntoa(ip),port,strerror(errno)));
+ sys_inet_ntoa(ip),port,strerror(errno)));
return(ret);
}
@@ -1069,7 +1070,7 @@ static int name_query_comp(uint8_t *p1, uint8_t *p2)
sort a set of 6 byte name query response records so that the IPs that
have the most leading bits in common with the specified address come first
***************************************************************************/
-void sort_query_replies(char *data, int n, struct in_addr ip)
+void sort_query_replies(char *data, int n, struct ipv4_addr ip)
{
if (n <= 1) return;
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index c641f8bf12..349b4b9a9c 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -49,7 +49,7 @@ struct smbcli_socket *smbcli_sock_init(TALLOC_CTX *mem_ctx)
connect a smbcli_socket context to an IP/port pair
if port is 0 then choose 445 then 139
*/
-BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct in_addr *ip, int port)
+BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct ipv4_addr *ip, int port)
{
NTSTATUS status;
@@ -71,7 +71,7 @@ BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct in_addr *ip, int por
}
talloc_steal(sock, sock->sock);
- status = socket_connect(sock->sock, NULL, 0, inet_ntoa(*ip), port, 0);
+ status = socket_connect(sock->sock, NULL, 0, sys_inet_ntoa(*ip), port, 0);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(sock->sock);
sock->sock = NULL;
@@ -159,7 +159,7 @@ resolve a hostname and connect
BOOL smbcli_sock_connect_byname(struct smbcli_socket *sock, const char *host, int port)
{
int name_type = 0x20;
- struct in_addr ip;
+ struct ipv4_addr ip;
char *name, *p;
BOOL ret;
diff --git a/source4/libcli/raw/libcliraw.h b/source4/libcli/raw/libcliraw.h
index 48abc82a68..9bbdd8a222 100644
--- a/source4/libcli/raw/libcliraw.h
+++ b/source4/libcli/raw/libcliraw.h
@@ -60,7 +60,7 @@ struct smbcli_negotiate {
/* this is the context for a SMB socket associated with the socket itself */
struct smbcli_socket {
- struct in_addr dest_ip;
+ struct ipv4_addr dest_ip;
/* dest hostname (which may or may not be a DNS name) */
char *hostname;