summaryrefslogtreecommitdiff
path: root/source3/lib/access.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/access.c')
-rw-r--r--source3/lib/access.c20
1 files changed, 18 insertions, 2 deletions
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)