summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-08-14 15:02:28 +0000
committerAndrew Tridgell <tridge@samba.org>1996-08-14 15:02:28 +0000
commitb4aaec504ae66dc6a0f05d12529100cb62d47afd (patch)
treefc5080ac49a976778194510378053d72270800a3
parent9735d7e8e2978ce17a001d7d5766faf382ff5788 (diff)
downloadsamba-b4aaec504ae66dc6a0f05d12529100cb62d47afd.tar.gz
changed "unsigned long" to "uint32" in several places (for IP
addresses) to keep 64 bit machines happy.
-rw-r--r--source/include/proto.h2
-rw-r--r--source/lib/access.c28
-rw-r--r--source/lib/interface.c12
-rw-r--r--source/lib/util.c14
-rw-r--r--source/locking/locking.c2
-rw-r--r--source/namedbname.c2
-rw-r--r--source/nameserv.c2
7 files changed, 30 insertions, 32 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index 4d1c4bf6f97..dd9413605fc 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -866,7 +866,7 @@ int open_socket_in(int type, int port, int dlevel);
int open_socket_out(int type, struct in_addr *addr, int port );
int interpret_protocol(char *str,int def);
int interpret_security(char *str,int def);
-unsigned long interpret_addr(char *str);
+uint32 interpret_addr(char *str);
struct in_addr *interpret_addr2(char *str);
BOOL zero_ip(struct in_addr ip);
void standard_sub_basic(char *s);
diff --git a/source/lib/access.c b/source/lib/access.c
index 4d5954096fc..079253cdbdc 100644
--- a/source/lib/access.c
+++ b/source/lib/access.c
@@ -272,20 +272,20 @@ static int string_match(char *tok,char *s)
/* masked_match - match address against netnumber/netmask */
static int masked_match(char *tok, char *slash, char *s)
{
- unsigned long net;
- unsigned long mask;
- unsigned long addr;
-
- if ((addr = interpret_addr(s)) == INADDR_NONE)
- return (NO);
- *slash = 0;
- net = interpret_addr(tok);
- *slash = '/';
- if (net == INADDR_NONE || (mask = interpret_addr(slash + 1)) == INADDR_NONE) {
- DEBUG(0,("access: bad net/mask access control: %s", tok));
- return (NO);
- }
- return ((addr & mask) == net);
+ uint32 net;
+ uint32 mask;
+ uint32 addr;
+
+ if ((addr = interpret_addr(s)) == INADDR_NONE)
+ return (NO);
+ *slash = 0;
+ net = interpret_addr(tok);
+ *slash = '/';
+ if (net == INADDR_NONE || (mask = interpret_addr(slash + 1)) == INADDR_NONE) {
+ DEBUG(0,("access: bad net/mask access control: %s", tok));
+ return (NO);
+ }
+ return ((addr & mask) == net);
}
diff --git a/source/lib/interface.c b/source/lib/interface.c
index 061ac08c7b4..59a542ca0e2 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -41,8 +41,8 @@ calculate the default netmask for an address
****************************************************************************/
static void default_netmask(struct in_addr *inm, struct in_addr *iad)
{
- unsigned long ad = ntohl(iad->s_addr);
- unsigned long nm;
+ uint32 ad = ntohl(iad->s_addr);
+ uint32 nm;
/*
** Guess a netmask based on the class of the IP address given.
*/
@@ -227,7 +227,7 @@ static void get_broadcast(struct in_addr *if_ipaddr,
/* sanity check on the netmask */
{
- unsigned long nm = ntohl(if_nmask->s_addr);
+ uint32 nm = ntohl(if_nmask->s_addr);
if ((nm >> 24) != 0xFF) {
DEBUG(0,("Impossible netmask %s - using defaults\n",inet_ntoa(*if_nmask)));
default_netmask(if_nmask, if_ipaddr);
@@ -238,9 +238,9 @@ static void get_broadcast(struct in_addr *if_ipaddr,
all MS operating systems do, we have to comply even if the unix
box is setup differently */
{
- unsigned long ad = ntohl(if_ipaddr->s_addr);
- unsigned long nm = ntohl(if_nmask->s_addr);
- unsigned long bc = (ad & nm) | (0xffffffff & ~nm);
+ uint32 ad = ntohl(if_ipaddr->s_addr);
+ uint32 nm = ntohl(if_nmask->s_addr);
+ uint32 bc = (ad & nm) | (0xffffffff & ~nm);
if_bcast->s_addr = htonl(bc);
}
diff --git a/source/lib/util.c b/source/lib/util.c
index 657e9cb1a0d..413f1c648e0 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -2738,7 +2738,7 @@ true if two IP addresses are equal
****************************************************************************/
BOOL ip_equal(struct in_addr ip1,struct in_addr ip2)
{
- unsigned long a1,a2;
+ uint32 a1,a2;
a1 = ntohl(ip1.s_addr);
a2 = ntohl(ip2.s_addr);
return(a1 == a2);
@@ -2885,10 +2885,10 @@ int interpret_security(char *str,int def)
/****************************************************************************
interpret an internet address or name into an IP address in 4 byte form
****************************************************************************/
-unsigned long interpret_addr(char *str)
+uint32 interpret_addr(char *str)
{
struct hostent *hp;
- unsigned long res;
+ uint32 res;
if (strcmp(str,"0.0.0.0") == 0) return(0);
if (strcmp(str,"255.255.255.255") == 0) return(0xFFFFFFFF);
@@ -2905,7 +2905,7 @@ unsigned long interpret_addr(char *str)
putip((char *)&res,(char *)hp->h_addr);
}
- if (res == (unsigned long)-1) return(0);
+ if (res == (uint32)-1) return(0);
return(res);
}
@@ -2916,7 +2916,7 @@ unsigned long interpret_addr(char *str)
struct in_addr *interpret_addr2(char *str)
{
static struct in_addr ret;
- unsigned long a = interpret_addr(str);
+ uint32 a = interpret_addr(str);
ret.s_addr = a;
return(&ret);
}
@@ -2926,7 +2926,7 @@ struct in_addr *interpret_addr2(char *str)
******************************************************************/
BOOL zero_ip(struct in_addr ip)
{
- unsigned long a;
+ uint32 a;
putip((char *)&a,(char *)&ip);
return(a == 0);
}
@@ -2979,7 +2979,7 @@ are two IPs on the same subnet?
********************************************************************/
BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask)
{
- unsigned long net1,net2,nmask;
+ uint32 net1,net2,nmask;
nmask = ntohl(mask.s_addr);
net1 = ntohl(ip1.s_addr);
diff --git a/source/locking/locking.c b/source/locking/locking.c
index 78661d69706..8f76ce43daf 100644
--- a/source/locking/locking.c
+++ b/source/locking/locking.c
@@ -49,7 +49,7 @@ BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
if ((offset & mask) != 0)
offset = (offset & ~mask) | ((offset & mask) >> 2);
#else
- unsigned long mask = ((unsigned)1<<31);
+ uint32 mask = ((unsigned)1<<31);
/* interpret negative counts as large numbers */
if (count < 0)
diff --git a/source/namedbname.c b/source/namedbname.c
index 177c36fc07e..42ad9ad009f 100644
--- a/source/namedbname.c
+++ b/source/namedbname.c
@@ -509,7 +509,7 @@ struct name_record *search_for_name(struct subnet_record **d,
if (!n)
{
struct in_addr dns_ip;
- unsigned long a;
+ uint32 a;
/* only do DNS lookups if the query is for type 0x20 or type 0x0 */
if (!dns_type && name_type != 0x1b)
diff --git a/source/nameserv.c b/source/nameserv.c
index 289f6702b3b..07b94ced5f3 100644
--- a/source/nameserv.c
+++ b/source/nameserv.c
@@ -185,8 +185,6 @@ void add_my_names(void)
for (d = subnetlist; d; d = d->next)
{
- BOOL wins_iface = ip_equal(d->bcast_ip, ipgrp);
-
add_my_name_entry(d, myname,0x20,nb_type|NB_ACTIVE);
add_my_name_entry(d, myname,0x03,nb_type|NB_ACTIVE);
add_my_name_entry(d, myname,0x00,nb_type|NB_ACTIVE);