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
commitebc96b7309dbce110ae63bcb91dd8ad5a2cadbbf (patch)
treef8677502a41e01ccf2b828d712e97faa62a32d2c
parent6475a9157464b132decbae2aee0f001a364c0dbe (diff)
downloadsamba-ebc96b7309dbce110ae63bcb91dd8ad5a2cadbbf.tar.gz
samba-ebc96b7309dbce110ae63bcb91dd8ad5a2cadbbf.tar.bz2
samba-ebc96b7309dbce110ae63bcb91dd8ad5a2cadbbf.zip
changed "unsigned long" to "uint32" in several places (for IP
addresses) to keep 64 bit machines happy. (This used to be commit b4aaec504ae66dc6a0f05d12529100cb62d47afd)
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/access.c28
-rw-r--r--source3/lib/interface.c12
-rw-r--r--source3/lib/util.c14
-rw-r--r--source3/locking/locking.c2
-rw-r--r--source3/namedbname.c2
-rw-r--r--source3/nameserv.c2
7 files changed, 30 insertions, 32 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 4d1c4bf6f9..dd9413605f 100644
--- a/source3/include/proto.h
+++ b/source3/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/source3/lib/access.c b/source3/lib/access.c
index 4d5954096f..079253cdbd 100644
--- a/source3/lib/access.c
+++ b/source3/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/source3/lib/interface.c b/source3/lib/interface.c
index 061ac08c7b..59a542ca0e 100644
--- a/source3/lib/interface.c
+++ b/source3/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/source3/lib/util.c b/source3/lib/util.c
index 657e9cb1a0..413f1c648e 100644
--- a/source3/lib/util.c
+++ b/source3/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/source3/locking/locking.c b/source3/locking/locking.c
index 78661d6970..8f76ce43da 100644
--- a/source3/locking/locking.c
+++ b/source3/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/source3/namedbname.c b/source3/namedbname.c
index 177c36fc07..42ad9ad009 100644
--- a/source3/namedbname.c
+++ b/source3/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/source3/nameserv.c b/source3/nameserv.c
index 289f6702b3..07b94ced5f 100644
--- a/source3/nameserv.c
+++ b/source3/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);