diff options
Diffstat (limited to 'source/lib/access.c')
-rw-r--r-- | source/lib/access.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/source/lib/access.c b/source/lib/access.c index 14a84b2fb44..8f57c37c26f 100644 --- a/source/lib/access.c +++ b/source/lib/access.c @@ -5,18 +5,17 @@ by Wietse Venema, Eindhoven University of Technology, The Netherlands. The code is used here with permission. The code has been considerably changed from the original. Bug reports -should be sent to Andrew.Tridgell@anu.edu.au +should be sent to samba-bugs@samba.anu.edu.au */ #include "includes.h" -#include "loadparm.h" #define ALLOW_PURE_ADDRESSES extern int DEBUGLEVEL; #ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long)~0) +#define INADDR_NONE ((uint32)~0) #endif @@ -37,14 +36,11 @@ static char sep[] = ", \t"; #define FAIL (-1) /* Forward declarations. */ -BOOL allow_access(char *deny_list,char *allow_list,struct from_host *client); static int list_match(char *list,char *item, int (*match_fn)()); static int client_match(char *tok,char *item); static int string_match(char *tok,char *s); static int masked_match(char *tok, char *slash, char *s); static int matchname(char *remotehost,struct in_addr addr); -BOOL fromhost(int sock,struct from_host *f); - /* Size of logical line buffer. */ #define BUFLEN 2048 @@ -276,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); } |