From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/lib/access.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'source3/lib/access.c') diff --git a/source3/lib/access.c b/source3/lib/access.c index f12ee92799..4e524735e4 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -30,7 +30,7 @@ static int masked_match(char *tok, char *slash, char *s) if (strlen(slash + 1) > 2) { mask = interpret_addr(slash + 1); } else { - mask = (uint32)((ALLONES >> atoi(slash + 1)) ^ ALLONES); + mask = (uint32)((ALLONES << atoi(slash + 1)) ^ ALLONES); } if (net == INADDR_NONE || mask == INADDR_NONE) { @@ -188,7 +188,7 @@ static int list_match(char **list,char *item, int (*match_fn)(char *, char *)) /* return true if access should be allowed */ -BOOL allow_access(char **deny_list,char **allow_list, +static BOOL allow_access_internal(char **deny_list,char **allow_list, char *cname,char *caddr) { char *client[2]; @@ -240,6 +240,22 @@ BOOL allow_access(char **deny_list,char **allow_list, return (True); } +/* return true if access should be allowed */ +BOOL allow_access(char **deny_list,char **allow_list, + const char *cname, const char *caddr) +{ + BOOL ret; + + char *nc_cname = smb_xstrdup(cname); + char *nc_caddr = smb_xstrdup(caddr); + + ret = allow_access_internal(deny_list, allow_list, nc_cname, nc_caddr); + + SAFE_FREE(nc_cname); + SAFE_FREE(nc_caddr); + return ret; +} + /* return true if the char* contains ip addrs only. Used to avoid gethostbyaddr() calls */ static BOOL only_ipaddrs_in_list(char** list) -- cgit